-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Nick Williams opened SPR-10593 and commented
org.springframework.context.annotation.FilterType
defines the following enum constants: ANNOTATION
, ASSIGNABLE_TYPE
, and CUSTOM
. For custom types, the user is supposed to supply an implementation of org.springframework.core.type.filter.TypeFilter
. Spring supplies implementations AnnotationTypeFilter
, which maps to ANNOTATION
, and AssignableTypeFilter
, which maps to ASSIGNABLE_TYPE
.
However, Spring also supplies implementations AspectJTypeFilter
and RegexPatternTypeFilter
, which do not have counterpart annotation parts. As a developer, it would be much easier for me to use these TypeFilter
s if there were ASPECTJ
and REGEX
enum constants to represent them.
Note that this will require the addition of a String expression
attribute on the ComponentScan.Filter
annotation. The documentation for ComponentScan.Filter
says this:
Note that the filter types available are limited to those that may be expressed as a Class in the value() attribute. This is in contrast to context:component-scan/, which allows for expression-based (i.e., string-based) filters such as AspectJ pointcuts. These filter types are intentionally not supported here, and not available in the FilterType enum.
However, this does not seem like a good policy to me. This is, in essence, saying "sorry, you can't use these types with programmatic configuration, you have to use XML." But this flies in the face of the idea that programmatic configuration is the future and should be able to replace XML configuration completely. With this statement, you rule out the possibility that everyone can use programmatic configuration.
Affects: 4.0 M1