<profiles>
<profile>
<id>local</id>
<properties>
<apollo.meta>http://apollo.aibeike.com:8080</apollo.meta>
<apollo.appId>tal-cloud-storage-rest</apollo.appId>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<apollo.meta>http://apollo.aibeike.com:8180</apollo.meta>
<apollo.appId>tal-cloud-storage-rest</apollo.appId>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>uat</id>
<properties>
<apollo.meta>http://apollo.aibeike.com:8080</apollo.meta>
<apollo.appId>tal-cloud-storage-rest</apollo.appId>
</properties>
</profile>
<profile>
<id>pro</id>
<properties>
<apollo.meta>http://10.81.34.26:8080,http://10.81.34.219:8080</apollo.meta>
<apollo.appId>jydriverest</apollo.appId>
</properties>
</profile>
</profiles>
在 pom.xml
中有以上配置,分别配置了本地、开发、仿真和生产环境的 Apollo 的 meta
和 appid
属性,其中 dev 环境是当前的默认配置,因为 pom.xml
中有 activeByDefault
配置:
<activation>
<activeByDefault>true</activeByDefault>
</activation>
然后再 application.properties
中可以通过以下方式获取到 pom.xml
的值:
app.id=@apollo.appId@
apollo.meta=@apollo.meta@
apollo.bootstrap.enabled = true
apollo.bootstrap.namespaces = application,cart-config,config,configurationCenter,dc-config,es-config,file-config,paper-config,paperrest-config,queryuserid,slice-config,storage-config,tiku-config,tiku3-config,uc-config,applet-config,oss-config,game-config