-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Improve circular import exception, in particular for @Import vs import through nesting [SPR-13101] #17692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented That might be a side effect from our handling of nested configuration classes: nesting a config class within an outer config class is a kind-of import from the outer class to the inner class (the way we're processing it). From that perspective, you could probably simply drop the In any case, we should not be throwing a circular import exception in such a scenario since there is no user-defined import circle... Juergen |
Juergen Hoeller commented This is indeed caused by the 'implicit' import through the nesting of configuration classes. I'll make sure to improve the circular import exception that way, explicitly pointing out that nesting might be involved. Fundamentally, we do want to process such a scenario as an import circle, enforcing the removal of the explicit Jeurgen |
Ashvin Kanani commented I don't use nested classes but still I am getting the same error when upgrading spring-boot version to |
Ashvin Kanani commented I have logged the issue I am facing at http://stackoverflow.com/questions/37963213/a-circular-import-has-been-detected |
Jean-Pierre Bergamin commented We're also facing a "Configuration problem: A circular Our case is like: A shared repository maven module contains: @Configuration
@ComponentScan
MyRepositoryContextConfiguration {
} @Configuration
@Import(MyRepositoryContextConfiguration.class)
MyRepositoryTestConfiguration {
} A webapp using this shared repository (including is as a test-jar as well) has: @Configuration
@Import(MyRepositoryTestConfiguration)
MyWebappTestConfiguration {
} The component scan in the MyRepositoryContextConfiguration class picks up the MyRepositoryTestConfiguration again when running tests and leads to the following error:
I don't think that an What do you think? |
Juergen Hoeller commented Jean-Pierre Bergamin, sounds valid, since a Could you please create a new JIRA ticket for this one? We might still address it for 4.3.2 later today then. |
Jean-Pierre Bergamin commented Please see #19086 |
Christopher Smith opened SPR-13101 and commented
I have the following configuration class, with a nested extension:
GalleryMockMvcConfig.InMemorySecurity
does not includeDigitizer
.When trying to use this class in
@ContextConfiguration
, I get the following exception:Affects: 4.1.6
Issue Links:
@Import
error caused by an@ComponentScan
The text was updated successfully, but these errors were encountered: