springboot yaml part2

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

2、优先级

二、配置不同的开发环境

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

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

原文地址:https://www.cnblogs.com/wt7018/p/13346354.html