Skip to content

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

Closed

Description

@spring-projects-issues

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

Activity

  1. spring-projects-issues commented on May 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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?

  2. spring-projects-issues commented on May 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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 ....
  3. spring-projects-issues commented on May 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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.

  4. spring-projects-issues commented on May 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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

  5. spring-projects-issues commented on May 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions