application.properties文件配置
在application.properties文件中配置mysql连接配置文件。
spring.datasource.url = jdbc:mysql://localhost:3306/DatebaseName(自己数据库名)
spring.datasource.username = root
spring.datasource.password = 123
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
在application.properties文件中配置JPA配置信息。
# Specify the DBMS
spring.jpa.database = MYSQL
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
#[org.hibernate.cfg.ImprovedNamingStrategy #org.hibernate.cfg.DefaultNamingStrategy]
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# stripped before adding them to the entity manager)
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
在application.properties文件中的服务器配置
server.port=8080 #端口号设置
server.servlet.context-path=/exam #访问路径设置