惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
有赞技术团队
有赞技术团队
罗磊的独立博客
博客园 - 叶小钗
Jina AI
Jina AI
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
量子位
MyScale Blog
MyScale Blog
V
Visual Studio Blog
博客园 - 聂微东
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
宝玉的分享
宝玉的分享

博客园 - 后端AI实验室

我带的那个实习生,比我更依赖AI——但他的问题和我完全不同 我用AI把一个外包需求从30天压到5天交付,然后客户说:下次还找你 我用 AI 设计了一套新人 onboarding 方案,两周后他的产出超出了我的预期 AI编程一年后,我还记得怎么手写代码吗?答案让我沉默了 裁员后我被迫负责运维,用AI从0搭建了可观测性平台 我把代码审查权交给AI两个月,团队发生了什么 等保三级整改,敏感数据加密,数十个系统——3个人用Cursor一周搞定了 我让AI模拟面试官考了我一个小时,然后我沉默了 同一个需求,我先出技术方案,再让AI出方案——差距让我沉默了 3年没人敢碰的老代码,我用AI重构了它——然后翻车了 我让AI review了自己写的代码,然后删掉了30% 我把一个生产Bug的排查过程,交给AI处理——20分钟后我关掉了它 我把同一个需求分别交给初级程序员、高级程序员和AI,结果让我沉默了 用AI写代码,我差点把漏洞发上线:血泪总结的10个教训 我用Cursor开发了3个月,整理出这套提效4倍的工作流 IntelliJ IDEA的统治即将终结?我已经3个月没怎么用它了 公司给团队配了Cursor,然后开始裁员:一个残酷但必须面对的真相 黄仁勋说编程只是打字?一个12年老程序员的冷静思考 springcloud-nacos配置中心 springcloud-nacos服务注册 springcloud-bus消息总线
springcloud-configclient手动刷新
后端AI实验室 · 2020-08-20 · via 博客园 - 后端AI实验室

1.依赖

 <!--引入consul-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
        </dependency>
        <!--引入健康检查-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

 2.配置文件

application.properties

server.port=9991
spring.application.name=configclient

spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.service-name=${spring.application.name}

management.endpoints.web.exposure.include=*

name=${name}

 bootstrap.properties

spring.cloud.config.name=sem
spring.cloud.config.profile=pro
spring.cloud.config.uri=http://127.0.0.1:9999/
spring.cloud.config.label=

 3.启动注解

@SpringBootApplication
public class ConfigclientApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigclientApplication.class, args);
    }

}

 4.controller

@RestController
@RefreshScope
public class TestController {
    @Value("${name}")
    private String name;

    @RequestMapping("/test")
    public String hello() {
        return name;
    }
}

 5.刷新

SVN配置文件修改提交后,configclient需要post发送刷新请求 URL:http://127.0.0.1:9991/actuator/refresh,再次访问带有@RefreshScope注解的controller配置文件修改后的值才能被重新加载。