Skip to content

Commit

Permalink
nacos 多配置集
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Jan 24, 2020
1 parent ec5a5be commit 1f00348
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@SpringBootApplication
// @NacosPropertySource(dataId = "example", type = ConfigType.YAML)
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
// 启动 Spring Boot 应用
ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);

// 查看 Environment
Environment environment = context.getEnvironment();
System.out.println(environment);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ nacos:
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP。
namespace: # 使用的 Nacos 的命名空间,默认为 null。
auto-refresh: true # 是否自动刷新,默认为 false。
# - # 这里,可以继续添加。

0 comments on commit 1f00348

Please sign in to comment.