springboot多环境配置

yaml配置文件加载位置优先级

1342

properties处理多环境配置

application-test.properties

server.port=8085

application-dev.properties

server.port=8086

application.properties

# springboot多环境配置,:可以选择激活哪一个

spring.profiles.active=test

yaml处理多环境配置

server:
  port: 8081
spring:
  profiles:
    active: test

---
server:
  port: 8082
spring:
  profiles: dev

---
server:
  port: 8083
spring:
  profiles: test

posted @ 2023-01-10 15:52  Fannaa  阅读(44)  评论(0)    收藏  举报