spring_reference/IV. Spring Boot features/23.6.3. Multi-profile YAML ...

19 lines
607 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 23.6.3. Multi-profile YAML文档
你可以在单个文件中定义多个特定配置profile-specific的YAML文档并通过一个spring.profiles key标示应用的文档。例如
```json
server:
address: 192.168.1.100
---
spring:
profiles: development
server:
address: 127.0.0.1
---
spring:
profiles: production
server:
address: 192.168.1.120
```
在上面的例子中如果development配置被激活那server.address属性将是127.0.0.1。如果development和production配置profiles没有启用则该属性的值将是192.168.1.100。