一、优先级
1、文件路径
file:./config/
file:./config/*/
file:./
classpath:/config/
classpath:/ 

2、优先级

springboot yaml part2

二、配置不同的开发环境

application.yml

spring:
  profiles:
    active: online


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

=============================================

server:
  port: 8084
spring:
  profiles:
    active: online
---
server:
  port: 8001
spring:
  profiles: dev
---
server:
  port: 8002
spring:
  profiles: online

注意:这个只是个demon

实际的开发环境是连接不同的数据库

 

相关文章:

  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-10-06
  • 2021-07-12
  • 2022-12-23
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2021-11-23
  • 2021-10-30
  • 2021-06-30
  • 2021-09-03
  • 2022-12-23
相关资源
相似解决方案