1. 程式人生 > >springboot多環境配置

springboot多環境配置

使用多個配置獲取環境

application.properties:

#主配置檔案,配置了這個會優先讀取裡面的屬性覆蓋主配置檔案的屬性
spring.profiles.active=dev
#server.port=8083
#時間格式化
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
#時區設定
spring.jackson.time-zone=Asia/Chongqing
---------------------------

application-dev.properties
#開發環境

server.port=8080

---------------------------

application-prod.properties

#開發環境

server.port=8081

----------------------
application-test.properties
#開發環境

server.port=8082