Skip to content

Default @ComponentScan's exclude filter to exclude @Configuration annotated classes [SPR-8880] #13521

Closed

Description

@spring-projects-issues

Oliver Drotbohm opened SPR-8880 and commented

Suppose you have an application with a base package of com.acme with an @Configuration class located in this package. Now suppose you use this configuration class as basePackageClass inside @ComponentScan. This will result in an exception saying the class is registered twice. So you pretty much end up with always adding this exclude.

Would it make sense to default the excludeFilters attribute of the @ComponentScan annotation as follows?

@Filter(type = FilterType.ANNOTATION, value = Configuration.class)

Affects: 3.1 RC2

Issue Links:

Activity

  1. spring-projects-issues commented on Nov 29, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Hi Ollie,

    This issue was actually addressed in #13450, and now available in RC2. Note particularly the resolution comment on that issue to understand the fix and why it doesn't require a default excludeFilters at all.

  2. spring-projects-issues commented on Nov 30, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Oliver Drotbohm commented

    Awesome, thanks! :)

  3. added
    type: enhancement
    in: core
    status: duplicate
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: duplicatetype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions