- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我能否仅在云配置服务器中使用 @RefreshScope
(连同属性上的 @Value
),或者我是否也可以在没有配置服务器的情况下使用?我正在尝试在没有配置服务器的情况下使用它。我试图通过更改 .property 文件中的值并尝试再次请求来获取 @Value
属性,我会得到更新的值吗?那可能吗?
最佳答案
不,您应该将它与配置服务器一起使用,否则您将无法即时读取更新属性。关注this article看看this如果您在动态加载更新的属性时遇到任何问题。
In theory, you could refresh the application context, but I wouldn't recommend this. Spring Cloud has provided an annotation to mark a bean as refreshable. By adding spring actuator, we can refresh those beans on the fly.
关于java - Spring 配置@RefreshScope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53559009/
Spring Cloud 中的新 @RefreshScope 很棒。但副作用是 Bean 变得延迟加载。大多数情况下,这不是问题,但急切加载的 bean 允许在启动时而不是稍后在运行时确保 DI、属性
我有一个 Spring Boot 应用程序。我正在使用 Spring Cloud Config 通过 Git 来外部化属性。一切正常。我希望在发出执行器刷新端点时刷新 bean。通过执行以下操作,Be
spring-boot-starter-actuator提供服务健康检查和暴露内置的url接口。 spring-cloud-starter-config提供动态刷新的一些支持和注解。
我能否仅在云配置服务器中使用 @RefreshScope(连同属性上的 @Value),或者我是否也可以在没有配置服务器的情况下使用?我正在尝试在没有配置服务器的情况下使用它。我试图通过更改 .pro
我有一个监控应用程序,其中我正在运行一个 fixedRate 任务。这是拉入使用 Consul 配置的配置参数。我想引入更新的配置,所以我添加了@RefreshScope。但是一旦我更新 Consul
我正在尝试使用 JUNIT 测试用例测试我的 Controller ,但发现以下异常 Caused by: java.lang.IllegalStateException: No Scope regi
是否有 @RequestScope 刷新后 Hook 的概念? 用例:我们需要推送配置更改。目前,这是手动的,并作为应用程序重新启动的一部分触发。但是,如果我们可以触发/bus/refresh,一旦环
我有一个 Controller 需要从配置服务器刷新配置,因此我在其上添加了@RefreshScope。同时这个 Controller 需要调用后端API,以便我定义restTemplate Bean
我正在使用 Spring Boot 和 Spring Cloud Config 服务实现一个服务来提供配置值。在我的服务中,我有几个配置值,当远程 Git 存储库中的值发生更改时需要刷新,并且我使用
我正在使用 Spring Boot 和 Spring Cloud Config 服务实现一个服务来提供配置值。在我的服务中,我有几个配置值,当远程 Git 存储库中的值发生更改时需要刷新,并且我使用
如果 DB.URL 的环境变量发生更改,我将尝试更新 DB 数据源。下面是我的类(class), @SpringBootApplication @ConfigurationProperties(val
据我了解,当您使用 Spring Cloud 的 RefreshScope 注解时,会注入(inject)一个对数据的代理,如果支持信息发生更改,代理会自动更新。不幸的是,我需要找到一种在刷新发生时收
我正在编写 spring boot 应用程序,它使用 spring 配置,部署在 pivotal cloud foundry 上并由 Netflix Eureka 公开 作为发现服务/负载平衡器。 我
我有一些自己定制的“入门”项目。我正在努力迁移到 Spring Boot 2.0、Framework 5.0 以及这些和其他地方的功能 bean 定义。 在“入门”项目中,我遵循的功能 bean 定义
我正在遵循此处描述的方法:https://github.com/jeroenbellen/blog-manage-and-reload-spring-properties ,唯一的区别是,在我的例子中
我们有一个现有的 Spring MVC 应用程序(非 Spring-boot 应用程序),其中所有(或大部分)bean 都配置在 XML 中。我们想将它用作 Spring Cloud Config C
我尝试使用 Config Server 实现 spring 外部配置。第一次启动应用程序时它工作正常,但没有反射(reflect)对属性文件的任何更改。我尝试使用/refresh 端点即时刷新我的属性
我们正在使用 Spring Cloud 外部化微服务的配置(基于 Spring Boot)。 根据我对Spring Cloud的理解,为了使bean能够从配置服务器加载刷新/更新的值,我们需要在Spr
我有一个 @Configuration 类,如下所示: @Configuration public class SampleKieConfiguration { @Bean publi
在我的 Spring boot 应用程序中,我们利用 @RefreshScope 在配置更改后动态重新加载 bean。它有效,但我在将 bean 上的 @RefreshScope 与注释为 @Post
我是一名优秀的程序员,十分优秀!