Search code examples
javaspringspring-bootamazon-sqs

Diagnosis of missing Spring AutoConfiguration class


I have a @SpringBootApplication with an implementation dependency on io.awspring.cloud:spring-cloud-aws-autoconfigure:2.4.4, which contains the class SQSAutoConfiguration. This autoconfiguration class kicks in at application start-up and constructs a SimpleMessageListenerContainer bean using the SimpleMessageListenerContainerFactory

Updating from Spring Boot 2.7.12 to 3.1.2, the SQS processing is no longer working. Debugging the Spring initialisation process, before and after, and using the gradle dependencies tool and the IntelliJ Spring Tool Window, I can confirm that whilst the spring-cloud-aws-autoconfigure dependency is still present, the SQSAutoConfiguration bean is now missing from the Spring context, as a result the SimpleMessageListenerContainer bean does not get created and so the SQS processing does not happen.

My question is - I have the tools to show me that the auto configure bean is missing after the spring boot version change, but what tools or techniques could I use to determine why Spring is not including this bean anymore.


Solution

  • If you upgrade Spring-boot you have to upgrade io.awspring.cloud:spring-cloud-aws-autoconfigure too: Spring-boot 3.x requires Spring-cloud 3.x.

    The full compatibility matrix is available at https://github.com/awspring/spring-cloud-aws#compatibility-with-spring-project-versions

    About the techniques "to determine why Spring is not including this bean anymore", generally speaking, you can examine the autoconfiguration report generated by Spring in debug mode.