spring-cloud / spring-cloud-bus

Spring Cloud event bus
http://cloud.spring.io/spring-cloud-bus/
Apache License 2.0
409 stars 242 forks source link

Mixed up AutoConfiguration order prevents RefreshBusEndpoint from being instantiated. #151

Closed joshiste closed 5 years ago

joshiste commented 5 years ago

The BusRefreshEndpointConfiguration matches on the ContextRefresher bean being present, but it is not guaranteed to be run after the RefreshAutoConfiguration, which adds the required bean.

This can result in a mixed up AutoConfiguration order and prevents the RefreshBusEndpoint from being instantiated when other AutoConfigurations are present (as in https://github.com/codecentric/spring-boot-admin/issues/1111).

spencergibb commented 5 years ago

BusRefreshConfiguration will need to be pulled out into it's own autoconfiguration to support the before. PRs welcom

y24jds commented 5 years ago

I have been trying to figure out why when I included spring-boot-admin-client in my dependencies, it was breaking the RefreshListener class. If I have the spring-boot-admin-client dependency, the console shows that it isn't creating RefreshListener because it doesn't think it has a refreshContext. But the odd thing is, it does have a refreshContext available for other beans like RefreshEndpointAutoConfiguration.RefreshEndpointConfiguration#refreshEndpoint

Here is how it looks when I don't have a RefreshListener BusAutoConfiguration#refreshListener: Did not match:

Is there a work-around that I could put in place for now? Somehow force early creation of ContextRefresher?

And is should my issue with RefreshListener be a separate issue?