-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Annotation-based filters for component scanning find meta-annotations as well #22551
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
Comments
Although this kind of question is better suited for Stack Overflow, I'll go ahead and answer your question here.
The net result is that you have instructed Spring to exclude from component scanning any classes that are directly annotated with If you would like to exclude exactly classes annotated directly with You can then specify |
Prior to this commit the documentation for annotation-based include and exclude filters used with component scanning did not explicitly mention the fact that annotations are considered a match if they are either present or meta-present on candidate classes. This commit improves the documentation in this regard. See gh-22551
@kingrockw, thanks to your question I noticed that the documentation was not explicit with regard to the default support for meta-annotations. I have therefore updated the documentation in b109f14. Cheers! |
As an alternative to my previous proposal to implement a custom <context:component-scan base-package="cn.rock" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan> |
Thank you very much for your answer. @sbrannen |
Uh oh!
There was an error while loading. Please reload this page.
Why can't the
DispatcherServlet
load the@Controller
class in Spring MVC config according to the above configuration?The text was updated successfully, but these errors were encountered: