springboot的application.properties的配置(jpa,mysql)

#連接mysql數據庫
spring.datasource.url=jdbc:mysql://localhost:3306/shiwu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server.tomcat.uri-encoding=UTF-8
 
#JPA Configuration:
spring.jpa.database=MYSQL
spring.jpa.show-sql=true  
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect

#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
#spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
#視圖配置
spring.mvc.view.prefix= /WEB-INF/view/
spring.mvc.view.suffix= .jsp
spring.transaction.rollback-on-commit-failure= true

 

 

 

注意:com.mysql.cj.jdbc.Driver是mysql-connector-java 6中的,如果是mysql5,使用com.mysql.jdbc.Driver

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章