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

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

 

posted @ 2020-07-20 17:41  市丸银  阅读(138)  评论(0编辑  收藏  举报