You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package com.xkcoding.nacos.config;
-
- import com.alibaba.nacos.api.config.annotation.NacosValue;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import static org.springframework.web.bind.annotation.RequestMethod.GET;
-
- @Controller
- @RequestMapping("config")
- public class ConfigController {
- @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
- private boolean useLocalCache;
-
- /**
- * 1.通过nacos官网下载nacos服务,启动nacos服务。
- * 通过调用 Nacos Open API 向 Nacos server 发布配置:dataId 为example
- * curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=example&group=DEFAULT_GROUP&content=useLocalCache=true"
- * @return
- */
- @RequestMapping(value = "/get", method = GET)
- @ResponseBody
- public boolean get() {
- return useLocalCache;
- }
- }
|