Closed QwertGold closed 3 years ago
@QwertGold thanks for the report. We had similar reports and it is already fixed via https://github.com/spring-cloud/spring-cloud-aws/pull/658. You can test the snapshots and let us know if it is working for you. I will close the issue but reopen it if it is now working please.
Describe the bug We recently upgraded to Hoxton.SR1 to SR8, and our code stopped working, After some debugging it turns out that
SimpleStorageProtocolResolver
gets registered as an ordered BeanFactoryPostProcessor, and it is now instantiated during a much earlier phase of the Application context refresh(). If the user's application defines the AmazonS3 bean this is very bad, because all PostProcessors are not loaded at this point, which means@Value
,@PostConstruct
and@Autowired
annotation are not processed for any@Bean
/@Configurations
that is AmazonS3 depends on.Sample I have build a small self contained project that demonstrates this issue https://github.com/QwertGold/springcloudbug Although this uses AWS, you don't need to configure anything, as the problem is clearly during bean initialization. Just put a breakpoint inside the
@Bean
method which creates the AmazonS3 instance, you will notice that@PostConstruct
is not called with SR8, but it is called with SR1. I don't know a good way of writing a test for this, since the problem occurs during bean initialization. You will probably have to investigate why Spring considersSimpleStorageProtocolResolver
an orderedBeanFactoryPostProcessor
and decides to instantiate it inPostProcessorRegistrationDelegate
line 172 (Spring 5.2.8)