ConfigClientController.java 703 字节
Newer Older
Q
qinyingjie 已提交
1 2 3 4 5 6 7
package com.kwan.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

Q
qinyingjie 已提交
8 9 10 11 12 13 14 15
/**
 * 需要向客户端发送post请求动态刷新才能生效
 * curl -X POST "http://localhost:7002/actuator/refresh"
 *
 * @author : qinyingjie
 * @version : 2.2.0
 * @date : 2023/1/10 17:26
 */
Q
qinyingjie 已提交
16 17
@RefreshScope
@RestController
Q
qinyingjie 已提交
18
class ConfigClientController {
Q
qinyingjie 已提交
19 20 21 22 23 24 25 26 27 28 29

    @Value("${from}")
    private String from;

    @RequestMapping("/from")
    public String from() {

        return this.from;
    }

}