1. Modify the port number: Add the Application.properties file: server.port=9090 will be able to change the port number to 9090
2. Connect to the database:
2.1: Modify Pom.xml Add
2.2:application.properties file Add:
########################################################
# # #datasource
########################################################
Spring.datasource.url = Jdbc:mysql://localhost:3306/fy
Spring.datasource.username = root
Spring.datasource.password = root
Spring.datasource.driverClassName = Com.mysql.jdbc.Driver
Spring.datasource.max-active=20
Spring.datasource.max-idle=8
Spring.datasource.min-idle=8
spring.datasource.initial-size=10
########################################################
# # JPA
########################################################
# Specify the DBMS
Spring.jpa.database = MYSQL
Spring.jpa.show-sql = True
Spring.jpa.hibernate.ddl-auto = Update
Spring.jpa.hibernate.naming-strategy = Org.hibernate.cfg.ImprovedNamingStrategy
Spring.jpa.properties.hibernate.dialect = Org.hibernate.dialect.MySQL5Dialect
3. Add DAO Interface
4. Writing Service Classes
5. Write a controller class
6. Visit Http://127.0.0.1:9090/demo2/save
7. The database saves a single piece of data
Learn springboot from scratch (MYQSL link + port modification +JPA mapping)