apollo界面 略
这里面涉及项目的创建,命名等。 暂略。
项目中配置apollo
pom.xml中引入(下列配置只是示例,不能直接用):
<dependency>
<groupId>com.test.ddd.gfs</groupId>
<artifactId>apollo-client</artifactId>
<version>1.1.4</version>
</dependency>
application.yml中添加:
#apollo配置
app:
id: maas-crmInfo
apollo:
bootstrap:
eagerLoad:
enabled: true
enabled: true
namespaces: crm-application
发现了吧,application.yml中没有常规的配置了,因为都放到apollo平台了。
apollo本地化
那么apollo可以本地化吗?如果不能本地话,那么调试起来太不方便了。
答案肯定是能。
1、先准备zip包(从网上找个即可)。 Win_opt.zip放到c:\opt下。
2、idea右键Edit Configurations,vm options填入:
-Dapollo.private.key=C:\opt\data\maas-fpInfo\apollo_key_gen\apollo_private_key
然后启动项目,本地的opt目录就会生成所需文件。
主要的文件有2个。
第一个,C:\opt\settings\server.properties文件。
sit配置示例:
env=SIT
apollo.meta=http://apolloconfig.test.sit
idc=sit+e8e7bcec11c6728bfdddasdfasdfd56c00
#idc=uat+e8e7bcec11c34857234132e0edc61030d56c00
本地化配置示例:
env=Local # 其实配置了local之后下面的参数无效了,因为直接从本地读取了
apollo.meta=http://apolloconfig.test.sit
idc=sit+e8e7bcec11c6728bfdddasdfasdfd56c00
第二个,C:\opt\data\maas-crmInfo\config-cache\maas-crmInfo+sit+e8e7bcec11c6728bf39yoiwueo1030d56c00+crm-application.properties
文件
配置也会自动生成,改一些参数为本地即可。