Skip to content

@ComponentScan should get processed without @Configuration as well [SPR-11769] #16391

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

Closed
spring-projects-issues opened this issue May 8, 2014 · 5 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented May 8, 2014

Adam Berlin opened SPR-11769 and commented

Currently, If I need to use @ComponentScan I also need to use @Configuration. I should not need to add both.


Issue Links:

Referenced from: commits b4d447f

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

I am not sure what you are referring to. Are you saying that if you include @ComponontScan it does not work unless you add @Configuration?

@spring-projects-issues
Copy link
Collaborator Author

Phil Webb commented

I think Adam means that you can't use @ComponentScan unless it's on a @Configuration class so the additional @Configuration annotation is somewhat unnecessary. We could add a @Configuration meta-annotation annotation to @ComponentScan so you can do this:

@ComponentScan
// @Configuration (no longer required)
public ....

@spring-projects-issues
Copy link
Collaborator Author

Phil Webb commented

I'm not totally sold on the idea, although you could argue that @Configuration is superfluous I think it does help with readability.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 9, 2014

Juergen Hoeller commented

This is somewhat along the lines of #15163 and could be addressed the same way: through extending the 'lite' candidate check in ConfigurationClassutils.isLiteConfigurationCandidate, just making the class-level annotations work but not implying @Configuration semantics.

Since we're doing this for @Import already (as per #15163), we should consider it for @ImportResource and @ComponentScan as well.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Adam Berlin commented

@Phil thanks for the clarification. That's exactly what I meant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants