例如 application.properties
- server.port=8080
- 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/spring
- spring.datasource.username = root
- spring.datasource.password = root
- 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
例如 application.yml
- server:
- port: 8080
- session-timeout: 30
- tomcat.max-threads: 0
- tomcat.uri-encoding: UTF-8
- spring:
- datasource:
- url : jdbc:mysql://localhost:3306/springboot
- username : root
- password : root
- 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
无聊小测试 假如两个配置文件同时存在的话 如果里面有相同配置的的话
例如 都有设置端口号
那么properties配置文件要强势一些
如果两个配置文件参数不冲突,两者配置文件参数都会生效