Yaml does not support multiple profiles.
When Nacos configuration is:
test1:
config: 2
---
spring:
profiles: alpha
test1:
config: alpha
---
spring:
profiles: beta
test1:
config: beta
And I set -Dspring.profiles.active=alpha
and get property named test1.config
, nacos-spring-boot
gave me the result beta
.
alpha
@PrepareConfigurations({"common_database.yml", "common_eureka.yml"})
public class WebApplication {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(WebApplication.class, args);
context.getEnvironment();
}
}