Spring Boot with JPA integration with one to many relationship tables (user, item)
- Import the project into Eclipse as Maven project
- Find
Application.java
from side bar, right click on the file, select 'Run As' > 'Java Application' from menu. - Point your browser to http://localhost:8080/users
- There are more endpoints. For details, check
UserController.java
The project uses embedded database by default. To use MySQL, follow the step.
- Comment out
embedded database
part and uncommentMySQL JDBC connector
part onpom.xml
- Uncomment
spring.datasource
part, and correct the configuration onapplication.yml
This application executes import.sql at launch on embedded database while schema.sql is executed on external database.