27 lines
891 B
Markdown
27 lines
891 B
Markdown
// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-boot-example/nacos-spring-boot-config-example
|
|
package com.alibaba.nacos.example.spring.boot.controller;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
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 {
|
|
|
|
@Value("${useLocalCache:false}")
|
|
private boolean useLocalCache;
|
|
|
|
public void setUseLocalCache(boolean useLocalCache) {
|
|
this.useLocalCache = useLocalCache;
|
|
}
|
|
|
|
@RequestMapping(value = "/get", method = GET)
|
|
@ResponseBody
|
|
public boolean get() {
|
|
return useLocalCache;
|
|
}
|
|
} |