Now our Application.properties file content is:
[Plain]View Plain Copy
- server.port=8090
- Server.session-timeout=30
- Server.context-path=
- Server.tomcat.max-threads=0
- Server.tomcat.uri-encoding=utf-8
- Spring.datasource.url = Jdbc:mysql://localhost:3306/newbirds
- Spring.datasource.username = root
- Spring.datasource.password = Mymysql
- Spring.datasource.driverClassName = Com.mysql.jdbc.Driver
- # 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
- 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
Many of the official demos are configured with YML files.
YML file benefits, natural tree-like structure, at a glance. But it was painful to change application.properties to APPLICATION.YML.
Here is the APPLICATION.YML content after replacement:
[Plain]View Plain Copy
- Server
- port:8090
- Session-timeout:30
- tomcat.max-threads:0
- Tomcat.uri-encoding:utf-8
- Spring
- DataSource
- Url:jdbc:mysql://localhost:3306/newbirds
- Username:root
- Password:mymysql
- DriverClassName:com.mysql.jdbc.Driver
- Jpa:
- Database:mysql
- Show-sql:true
- Hibernate:
- Ddl-auto:update
- Naming-strategy:org.hibernate.cfg.improvednamingstrategy
- Properties
- Hibernate:
- Dialect:org.hibernate.dialect.MySQL5Dialect
Note the point:
1, the original key, such as Spring.jpa.properties.hibernate.dialect, press "." Split, all into a tree-like configuration
2,key after the colon, must follow a space
3, delete the original application.properties. Then be sure to execute the maven-x clean install
Springboot's application.properties differs from the. Yml