Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 781 Bytes

File metadata and controls

46 lines (32 loc) · 781 Bytes

Why do this?

Description

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.

Expected

alpha

See: nacos-group/nacos-spring-boot-project#226

Usage

@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();
    }

}