spring boot 環境 spring
能夠在vm 中加入緩存
-Dapp.id=yxcapp -Dapollo.meta=http://192.168.64.129:8080app
或者在application.properties
加上ide
app.id =yxcapp
apollo.meta=http://192.168.64.129:8080spa
而後在啓動頭加上
@EnableApolloConfigcode
代碼中使用
@Value("${test:200}")blog
非spring 環境 Config config = ConfigService.getAppConfig(); String someKey = "test"; String someDefaultValue = "someDefaultValueForTheKey"; while (true) { String value = config.getProperty(someKey, someDefaultValue); System.out.println(value); } 注意事項
· Mac/Linux: /opt/data/{appId}/config-cacheget
· Windows: C:\opt\data{appId}\config-cacheit
修改本地路徑文件不會生效
可是apollo死亡時,啓動時會讀取本地文件io
這種狀況 定製的值不變化
3.spring boot 中 使用多個Namespace 是,相同key只有一個生效
4.監聽