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
|
||||
package com.alibaba.nacos.example.spring.boot.controller;
|
||||
// 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.cloud.controller;
|
||||
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("config")
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
@RefreshScope
|
||||
public class ConfigController {
|
||||
|
||||
@Value("${useLocalCache:false}")
|
||||
private boolean useLocalCache;
|
||||
|
||||
public void setUseLocalCache(boolean useLocalCache) {
|
||||
this.useLocalCache = useLocalCache;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get", method = GET)
|
||||
@ResponseBody
|
||||
@RequestMapping("/get")
|
||||
public boolean get() {
|
||||
return useLocalCache;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue