-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Description
This enhancement idea is based on the findings after this question in Stack Overflow:
For me it was not obvious that when adding @ComponentScan
in the application class it would override the defaults set by @SpringBootApplication
(mainly the defaults set for excludeFilters).
I think there are multiple possibilities to make this clearer:
-
When Spring Boot finds a
@ComponentScan
in the application class and it does not have the two default exclude filters (TypeExcludeFilter and AutoConfigurationExcludeFilter) it should throw an exception. An attribute could also be added to@SpringBootApplication
to let the developer bypass this check if desired. -
Would it make sense to simply deny the use of
@ComponentScan
in the application class? -
Spring Boot could automatically consider the two default filters even if they are not specified in the
@ComponentScan
annotation when it is in the application class. -
Would it make sense to move the default exclude filters from the
@SpringBootApplication
annotation to the@ComponentScann
annotation?