Read how to build this project from scratch here -> tutorial
(It's very messy right now)
Here are the tools you need:
- Docker (duh)
- Eclipse (I'm using Eclipse Photon)
- Java10
git clone https://github.com/HechengLi/Docker_SpringBoot_Tomcat_MySQL_Demo.git
Open your eclipse
On the taskbar click File -> Import -> Maven -> Existing Maven Project
Select the folder TianMiao the Root Directory (You should see /pom.xml com.example:TianMiao:0.0.1-SNAPSHOT:war in Projects)
Click Finish
Right click TianMiao in Package Explorer -> Run As -> Run Configurations
Type 'clean install -Dmaven.test.skip=true' in Goals
Click Apply then Run (you should have TianMiao.war under Docker_SpringBoot_Tomcat_MySQL\TianMiao\target)
Open your commandline, cd to the git directory
Make sure you have docker app running
Run 'docker-compose -f stack.yml up' (add -d if you want it to run in background)
If you get an error while starting tomcat, it probably is because the docker container running Tomcat doesn't wait for MySQL to finish running it's setup script.
Wait for MySQL to finish running its script (it will log ...ready for connections...)
Stop all containers and start again should fix the problem.
Send Get Request to 'http://localhost:8080/TianMiao/api/users' to retrive data
Send Post Request to 'http://localhost:8080/TianMiao/api/users' with json {'username': 'anyusername'} to add data