其他分享
首页 > 其他分享> > Nacos 动态刷新@RefreshScope

Nacos 动态刷新@RefreshScope

作者:互联网

1、在需要动态刷新的类上加上@RefreshScope注解

  

package com.ne.isuzu.sim.manage.web.controller;

/**
 * <p>
 * 动态刷新测试
 * </p>
 *
 * @author Yungui.Zheng
 * @since 2020-07-02
 */
@Api(description = "流程操作")
@RestController
@RequestMapping("/sim/order/process")
@Slf4j
@RequiredArgsConstructor
@Validated
@RefreshScope
public class SimOrderProcessController {

    private final ISimOrderProcessService processService;
    /**
     * 动态数值
     */
    @Value("${andy.age}")
    private Integer age;

    @ApiOperation(value = "动态刷新测试")
    @GetMapping(value = "/test")
    public Response<?> test() {
        return Response.success(age);
    }

}

  

标签:age,RefreshScope,Nacos,private,刷新测试,刷新,动态,Response
来源: https://www.cnblogs.com/irobotzz/p/13254429.html