- Pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- 配置文件名称不能为bootstrap.yml,对于纯springBoot项目来说不会识别,如果是springCloud项目可以使用bootstrap.yml
- 使用方式:
# 指定环境:
spring:
profiles:
active: dev
# 开发环境
---
spring:
config:
activate:
on-profile: dev
server:
port: 8082
# 生产环境
---
spring:
config:
activate:
on-profile: prod
server:
port: 8083