Update java.md
This commit is contained in:
parent
b149d9dfcc
commit
494827474e
22
java.md
22
java.md
|
@ -1,26 +1,20 @@
|
||||||
// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-boot-example/nacos-spring-boot-config-example
|
// Refer to document: https://github.com/nacos-group/nacos-examples/tree/master/nacos-spring-cloud-example/nacos-spring-cloud-config-example
|
||||||
package com.alibaba.nacos.example.spring.boot.controller;
|
package com.alibaba.nacos.example.spring.cloud.controller;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
@RestController
|
||||||
|
@RequestMapping("/config")
|
||||||
@Controller
|
@RefreshScope
|
||||||
@RequestMapping("config")
|
|
||||||
public class ConfigController {
|
public class ConfigController {
|
||||||
|
|
||||||
@Value("${useLocalCache:false}")
|
@Value("${useLocalCache:false}")
|
||||||
private boolean useLocalCache;
|
private boolean useLocalCache;
|
||||||
|
|
||||||
public void setUseLocalCache(boolean useLocalCache) {
|
@RequestMapping("/get")
|
||||||
this.useLocalCache = useLocalCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/get", method = GET)
|
|
||||||
@ResponseBody
|
|
||||||
public boolean get() {
|
public boolean get() {
|
||||||
return useLocalCache;
|
return useLocalCache;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue