SpringBoot 之 多環境切換


方式一:分開多個配置文件

# /src/main/resources/application.yaml
server:
	port: 8080
spring:
	profiles:
		active: dev
# /src/main/resources/application-dev.yaml
server:
	port: 8081
# /src/main/resources/application-test.yaml
server:
	port: 8082

方式二:寫在同一個配置文件中

# /src/main/resources/application.yaml
server:
	port: 8080
spring:
	profiles:
		active: dev

---
server:
	port: 8081
spring:
	profiles: dev

---
server:
	port: 8082
spring:
	profiles: test


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM