Basic template for spring boot app
- It is recommended to add your own
application-dev.yml
file, for your local configuration settings. - To run the application do
./gradlew bootRun
- There are 2 urls right now :
/api/user
which returns a json for user. and/api/saveUser
which saves a new user with hardcoded values. - Save user first before getting it. :-)
- To run test cases :
./gradlew test
- To run test reports :
./gradlew jacocoTestReport
Note : It is necessary to run test cases before running jacocoTestReport. We can also build.gradle to run test automatically before you run jacocoTestReport, but I have not done it yet.
Using Docker (Recommened) :
- Install Docker
- Install & setup Docker machine (I think this is needed only for Mac OS)
- Install Docker-compose
- Start Docker machine
- Run
eval "$(docker-machine env <machine-name>)"
- Run
docker-compose up
The last command should start a bunch of download for postgres, gradle, java and other images. Grab a cup of coffee and your app should run.
Without using Docker :
- Setup gradle and postgres on your machine.
- Create a new application-dev.yml (in src/main/resources/config) for your local configurations. (Do not commit this file.)
- Run
./gradlew bootRun
. If all is good. This should make your application come up, after a bunch of downloads of course.