当前位置: 首页 > 知识库问答 >
问题:

spring配置服务器未刷新属性

穆宾白
2023-03-14

我有一个SpringBoot应用程序,它使用配置服务器加载其属性。属性存在于src中。配置服务器项目的main/resources/config目录。

当我到达restfulendpoint时,属性初始加载良好,然后当我更改属性时,它仍然显示旧的属性值。如何在调用URL时调用刷新终结点?我是在配置服务还是你好服务上调用它?即使从日志看起来已经映射了它们,它仍然会抛出405错误

配置服务器

http://localhost:8889/refresh

或者你好-服务

http://localhost:9001/refresh

我总是得到下面这些

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Oct 20 10:48:03 BST 2015
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported

在src/main/resources/config的配置服务器中,我有以下文件

你好,服务台。性质

#very-so-much=testing
very-so-much=testing second time
second-time=checking again

在我的问候服务中,我有以下几点

application.class

 @Bean
    @RefreshScope
    CustomerProps customerProps( @Value("${very-so-much}") String exclamations, @Value("${second-time}") String test) {
        CustomerProps p = new CustomerProps();
        //p.setText(exclamations);
        p.setText(test);
        return p;
    }

控制器类

//    @Value("${very-so-much}")
//    private String prop;
//    
//    @Value("${second-time}")
//    private String anotheerProp;

    @Autowired
    public GreetingController(CustomerRepository repository, GridFsTemplate gridFileSystem, CustomerProps props) {
        this.repository = repository;
        this.fs = gridFileSystem;
        this.props = props;
    }

    @RequestMapping("/greeting")
    public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
        name = props.getText();
        return new Greeting(counter.incrementAndGet(),
                            String.format(template, name));
    }

config server的启动日志显示以下endpoint

    2015-10-20 10:25:49.616  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
    2015-10-20 10:25:49.617  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/restart],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
    2015-10-20 10:25:49.618  INFO 13120 --- [           main] 
o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
    2015-10-20 10:25:49.618  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/reset],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
    2015-10-20 10:25:49.619  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.619  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.620  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
    2015-10-20 10:25:49.620  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.620  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.620  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.626  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/refresh],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
    2015-10-20 10:25:49.628  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
    2015-10-20 10:25:49.629  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.629  INFO 13120 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
    2015-10-20 10:25:49.697  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2015-10-20 10:25:49.710  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
    2015-10-20 10:25:49.712  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'restartEndpoint' has been autodetected for JMX exposure
    2015-10-20 10:25:49.712  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
    2015-10-20 10:25:49.714  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
    2015-10-20 10:25:49.715  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
    2015-10-20 10:25:49.721  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
    2015-10-20 10:25:49.751  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
    2015-10-20 10:25:49.760  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
    2015-10-20 10:25:49.768  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,type=ConfigurationPropertiesRebinder]
    2015-10-20 10:25:49.787  INFO 13120 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.bootstrap.config:name=refreshEndpoint,type=RefreshEndpoint]
    2015-10-20 10:25:49.791  INFO 13120 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
    2015-10-20 10:25:49.897  INFO 13120 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8889 (http)
    2015-10-20 10:25:49.898  INFO 13120 --- [           main] doge.ConfigurationServerApplication      : Started ConfigurationServerApplication in 4.485 seconds (JVM running for 5.233)
    2015

我的hello服务日志如下所示

2015-10-20 10:36:24.822  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2eea88a1: startup date [Tue Oct 20 10:36:21 BST 2015]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@400cff1a
2015-10-20 10:36:24.886  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/customer],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto org.springframework.http.ResponseEntity<?> hello.GreetingController.add(hello.Customer)
2015-10-20 10:36:24.887  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/customer/add],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public hello.Customer hello.GreetingController.insertCustomer(java.lang.String,java.lang.String)
2015-10-20 10:36:24.887  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/customer/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public hello.Greeting hello.GreetingController.greeting(java.lang.String)
2015-10-20 10:36:24.887  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/customer/{lastName}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<?> hello.GreetingController.readCustomer(java.lang.String)
2015-10-20 10:36:24.889  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-10-20 10:36:24.889  INFO 11564 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2015-10-20 10:36:24.914  INFO 11564 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-10-20 10:36:24.914  INFO 11564 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-10-20 10:36:24.947  INFO 11564 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-10-20 10:36:25.333  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.333  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/trace],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.334  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/restart],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
2015-10-20 10:36:25.334  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2015-10-20 10:36:25.334  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/pause],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2015-10-20 10:36:25.335  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2015-10-20 10:36:25.335  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.335  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/refresh],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2015-10-20 10:36:25.336  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/resume],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2015-10-20 10:36:25.336  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/dump],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.336  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.337  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
2015-10-20 10:36:25.337  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/reset],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
2015-10-20 10:36:25.338  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2015-10-20 10:36:25.338  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.338  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.338  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.338  INFO 11564 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2015-10-20 10:36:25.373  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2015-10-20 10:36:25.380  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2015-10-20 10:36:25.380  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'restartEndpoint' has been autodetected for JMX exposure
2015-10-20 10:36:25.381  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2015-10-20 10:36:25.381  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2015-10-20 10:36:25.382  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2015-10-20 10:36:25.384  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2015-10-20 10:36:25.398  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
2015-10-20 10:36:25.405  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2015-10-20 10:36:25.411  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,type=ConfigurationPropertiesRebinder]
2015-10-20 10:36:25.425  INFO 11564 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.bootstrap.config:name=refreshEndpoint,type=RefreshEndpoint]
2015-10-20 10:36:25.431  INFO 11564 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2015-10-20 10:36:25.529  INFO 11564 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9001 (http)

谢谢

共有2个答案

夹谷星剑
2023-03-14

Spring2

  1. Url-http://localhost:

爱炯
2023-03-14

因为这是一个POST请求,因此运行curl命令,如下所示

curl -d {} http://localhost:9001/refresh

确实刷新了我的属性。

 类似资料:
  • 我已经配置了spring cloud config,它从GitHub获取属性。如果发送到,我还可以在应用程序中获得更新的值。 我是否需要为它实现Rabbitmq和云总线,或者有任何其他简单的方法来实现它?另外,该文档指出,我们需要为推送通知添加对spring-cloud-config-monitor库的依赖关系。http://projects.spring.io/spring-cloud/spri

  • 我正在使用PCF提供的配置服务器实例,该实例由基于GIT的repo-to-server属性支持。我的应用程序连接到此配置服务器服务实例,并公开“刷新”endpoint。除了在更新属性后立即更改git中的属性并将http post发送到应用程序(/actuator/refresh)之外,其他一切都正常工作,我没有得到更新的prop name作为响应。如果我等待几秒钟,然后再次发送http post以

  • 我有一个配置服务器,一个Spring Boot2.3.1应用程序连接到该服务器,为正确的配置文件加载配置属性。 配置服务器使用git获取每个应用程序和配置文件的配置文件。 这工作正常,当Spring Boot应用程序启动时,它将从配置服务器加载属性的正确值。 当我在配置文件中更新一个值并将其推送到git中,然后对Spring Boot应用程序的endpoint执行操作时,我会看到返回一个json,

  • 我可以动态刷新Spring Boot的自动配置设置所使用的属性吗? 例如,我设置了以下属性(通过云配置)来自动配置: 现在,如果我更改配置服务器上的密码道具,并命中终结点,我可以看到已检索到更新的道具,但没有刷新。 我知道我可以手动配置bean,并确保它们属于,但我希望找到一种方法将自动配置的属性标记为“可刷新”。我有一些用例,我想刷新Spring Boot为数据源之外的其他bean使用的道具,手

  • 据我所知,当Spring Cloud Config Server配置更改时,可以通过Spring Cloud Bus在微服务之间传播刷新事件。然后,这会触发通知的微服务从Spring Cloud Config Server中提取最新配置。 这种方法的扩展性好吗?我的意思是,我们可以有1000个微服务实例,如果一些全局配置发生变化,那么所有这1000个微服务都会在同一时刻尝试从配置服务器获取配置。这

  • 我有一个使用SpringCloud配置的Spring Boot应用程序,我正在尝试从Bitbucket获取应用程序的配置文件。前一段时间我可以获取配置文件,但现在我在尝试通过配置服务器url访问时出错。 应用yml: 当我试图访问网址的应用程序显示一个错误-未授权: 有人知道发生了什么吗?我已经检查了bitbucket上的所有凭据和url。