Skip to content

refresh scope invalid when use bean properties, but use @value is ok.  #927

Closed
@dragontree101

Description

@dragontree101

i upgrade springboot to 2.0.0.RC2 and use spring-cloud-config to 2.0.0.BUILD-SNAPSHOT

i define InfoConfig

@Data
@ConfigurationProperties(prefix = "test")
public class InfoConfig {
  private String info;
}

and i have controller

@RefreshScope
@RestController
@EnableConfigurationProperties(InfoConfig.class)
public class InfoController {

  @Autowired
  private InfoConfig infoConfig;

  @Value("${test.value}")
  private String value;


  @GetMapping(value = "/info")
  public String info() {
    return infoConfig.getInfo();
  }

  @GetMapping(value = "/value")
  public String value() {
    return value;
  }

}

when i call curl -XPOST '127.0.0.1:8081/actuator/refresh' ,
response is ["config.client.version","test.value","test.info"]
i think both change test.value and test.info

but i request /info and /value, i found test.value is changed, but infoConfig.getInfo() not change.

and my project is https://github.com/lord-of-code/spring-cloud-not-refresh-bean

this is a bug ? or i use cloud-config mistake in springboot 2 and springcloud 2

in springboot 1.5.x and springcloud 1.x, it seems can both change by /refresh request.

Activity

ryanjbaxter

ryanjbaxter commented on Feb 26, 2018

@ryanjbaxter
Contributor

@dragontree101 sounds similar to spring-cloud/spring-cloud-commons#328 (comment). If so you can close this issue and follow the one in spring cloud commons.

dragontree101

dragontree101 commented on Feb 26, 2018

@dragontree101
Author

ok thanks, i will close this issue and follow this problem in spring cloud sommons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ryanjbaxter@dragontree101

        Issue actions

          refresh scope invalid when use bean properties, but use @value is ok. · Issue #927 · spring-cloud/spring-cloud-config