程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了没有Spring Cloud Config Server的RefreshScope运行时配置大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决没有Spring Cloud Config Server的refreshScope运行时配置?

开发过程中遇到没有Spring Cloud Config Server的refreshScope运行时配置的问题如何解决?下面主要结合日常开发的经验,给出你关于没有Spring Cloud Config Server的refreshScope运行时配置的解决方法建议,希望对你解决没有Spring Cloud Config Server的refreshScope运行时配置有所启发或帮助;

是的,只包括Spring Cloud Starter@H_944_3@

<parent>
    <groupID>org.springframework.boot</groupID>
    <artifactID>spring-boot-starter-parent</artifactID>
    <version>1.5.2.RELEASE</version>
</parent>
<dependencymanagement>
    <dependencIEs>
        <dependency>
            <groupID>org.springframework.cloud</groupID>
            <artifactID>spring-cloud-dependencIEs</artifactID>
            <version>Dalston.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencIEs>
</dependencymanagement>
<dependencIEs>
    <dependency>
        <groupID>org.springframework.cloud</groupID>
        <artifactID>spring-cloud-starter</artifactID>
    </dependency>
</dependencIEs>

解决方法

是否可以使用@refreshScope通过POST rest api / refresh调用刷新property(api-url),而无需设置spring
cloud配置服务器和spring cloud配置客户端。@H_944_3@

for.eg消费者.java@H_944_3@

@service
public class Consumer {

@value(${api-url})
private String apiUrl;

现在正在从application.yml中读取api-url。我想在运行时更改api-url而不重启服务器。@H_944_3@

Spring靴子有可能吗?@H_944_3@

大佬总结

以上是大佬教程为你收集整理的没有Spring Cloud Config Server的RefreshScope运行时配置全部内容,希望文章能够帮你解决没有Spring Cloud Config Server的RefreshScope运行时配置所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。