Our integration tests started to fail after the upgrade to 2.3.4.
Caused by: java.lang.IllegalArgumentException: No auto-configuration attributes found. Is TestClass annotated with EnableAutoConfiguration?
at org.springframework.util.Assert.notNull(Assert.java:218)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAttributes(AutoConfigurationImportSelector.java:155)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationEntry(AutoConfigurationImportSelector.java:122)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:434)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:879)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780)
The setup looks like
@ContextConfiguration(classes = TestConfig.class)
public class IntegrationTest{
}
@Configuration
@ActiveProfiles("test")
@Import({ DummyConfig.class })
public class TestConfig extends MainConfig {
}
After adding the @EnableAutoConfiguration to my integration tests, the test started to pass. However, I did not have to add any annotation in the spring earlier versions. Also, from the debugging I could see that AutoConfigurationImportSelector is never invoked in 2.0.8 but is invoked in 2.3.4. Is this what I should expect as a behaviour change in spring upgrade? If not, please let me know the cause of this issue
Comment From: wilkinsona
Thanks for the report, but I'm struggling to understand the problem from what you've described thus far. The exception message mentions TestClass
but you haven't shared the code for it. You also haven't shared MainConfig
or DummyConfig
. Unfortunately, without seeing all of the code that's involved, it isn't possible to accurately diagnose the problem.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: nandwaniS
Okay, I will put up a sample here
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.