Apollo简单配置
添加依赖
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.1.0</version>
</dependency>
添加注解
@EnableApolloConfig //自定义缓存路径
配置
#apollo集成
#apollo 配置应用的 appid
app.id=test
#apollo meta-server地址,一般同config-server地址
apollo.meta=http://localhost:18080/
#启用apollo配置开关
apollo.bootstrap.enabled=true
#设置在应用启动阶段就加载 Apollo 配置
apollo.bootstrap.eagerLoad.enabled=true
#apollo 使用配置的命名空间,多个以逗号分隔
apollo.bootstrap.namespaces = application
Apollo注册默认地址
http://localhost:18070
客户端获取配置(Java API样例)
Config config = ConfigService.g