Spring Boot多环境指定yml或者properties
文章目录
- Spring Boot多环境指定yml或者properties
- 加载顺序
- 配置指定某个yml
加载顺序
● application-local.properties
● application.properties
● application-local.yml
● application.yml
application.propertes
server.port=8111
application-local.propertes
server.port=8222
application.yml
spring:
profiles:
active: local
application-local.yml
server:
port: 8081
配置指定某个yml
spring:
profiles:
active: local
删除properties之后,项目启动
2023-08-23 09:38:29.423 INFO 22896 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path ‘’
2023-08-23 09:38:29.819 INFO 22896 — [ main] c.g.s.SpringBootSelfExerciseApplication : Started SpringBootSelfExerciseApplication in 9.315 seconds (JVM running for 11.995)