Spring Boot多環(huán)境指定yml或者properties
加載順序
● 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)文章來源:http://www.zghlxwxcb.cn/news/detail-674645.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-674645.html
到了這里,關(guān)于Spring Boot多環(huán)境指定yml或者properties的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!