160731liupf opened a new pull request #1405: 【SCB-1615】Extended dynamic configuration support for Nacos URL: https://github.com/apache/servicecomb-java-chassis/pull/1405 How to use: 1.Download base model from http://start.servicecomb.io and add maven dependence: org.apache.servicecomb config-nacos 2.0.0-SNAPSHOT 2.Start nacos console model(git url:https://github.com/alibaba/nacos) ,both account and password is "nacos" and add properties(example): Data ID: example Group:DEFAULT_GROUP JSON: { "nacos":"666" } 3.In base model,add info in microservice.yaml: nacos: config: serverAddr: 127.0.0.1:8848 dataId: example group: DEFAULT_GROUP 4.Then add blow code and start base model,you will get properties(If properties on nacos has changed, you can also get new value): @RestSchema(schemaId = "nacos") @RequestMapping(path = "/") public class NacosImpl { /** * 从nacos获取配置 * @return */ @GetMapping(path = "/config") @Responsebody public String config() throws Exception{ final String config = DynamicPropertyFactory.getInstance() .getStringProperty("nacos","").getValue(); return JSON.toJSONString(config); } }
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
