More details in tutorial
# set up local db
docker-compose -f docker-compose.local.yml up
# run spring application
./gradlew bootRun
# request
curl http://localhost:8080/hello
- generate idea project config
./gradlew idea
- enable git hooks
git config --local core.hooksPath .githooks/
chmod 700 .githooks/pre-push
- config your IDEA
-
Import code style
- Open IDEA, enter
Preferences -> Editor -> Code Style -> Import Schema
- Choose
config/GoogleStyle.xml
This style is based on GoogleStyle and default Kotlin style of Intellij Team, is suitable for both Java and Kotlin.
- Open IDEA, enter
-
New line end of file
- Enter
Preferences -> Editor -> General
- Check on
Other: Ensure line feed at file end on Save
- Enter
-
Set jvm of gradle
- Enter
Build, Execution, Deployment -> Build Tools -> Gradle
- Select
Gradle JVM: Use Project JDK
If the jvm is different with your project, will cause 'No tests found' error
- Enter
-
(Optional) Automatic format before commit when using IDEA commit dialog
- Enter
Preferences -> Version Control -> Commit Dialog
- Check on Reformat/Optimize/Cleanup
- Enter
- init test & integration test
# unit test & lint
./gradlew clean check
# api test (must run after test)
./gradlew clean check apiTest
# (optional) test coverage report
./gradlew jacocoTestReport
- container test
# package
./gradlew clean build bootJar
# start in test container
docker-compose -f docker-compose.test.yml up --build
# build image
docker build -t kotlin-spring-webflux .
# inject environment variables, check details in config/application-dev.yml
docker run -p 8080:8080 <environment> kotlin-spring-webflux
Should put this part into CI/CD, DON'T manually deploy in production If you want to check it locally, please try container test