Spring annotation-based container configuration context:include & exclude filters
- by lisak
Hey,
first off I point to the similar question. I spent more than an hour to set this up, but PathMatchingResourcePatternResolver still scans everything.
I have one common.xml (that is imported from specific.xml) and a specific.xml bean definition file. The context is loaded from specific.xml. In common.xml there is this element:
<context:component-scan base-package="cz.instance.transl">
<context:exclude-filter type="aspectj"
expression="cz.instance.transl.model..* && cz.instance.transl.service..* && cz.instance.transl.hooks..*"/>
</context:component-scan>
Where classes in packages like cz.instance.transl.service.* should not be subject of scanning, but everything else in here cz.instance.transl.* should be scanned through. But PathMatchingResourcePatternResolver marks everything as matching resources. It is the same with regex.
BTW: in xml style configuration, one can have many components that share a common.xml beans via "import resource" when loading context. How this is done when Annotation-based container configuration is used ?