is it possible to exclude a @Component
annotated class?
i would like to exclude a special class from JUnit testing.
my project has a class xEventHandler
annotated with @Component
and i dont want spring to use this class while junit testing.
my ApplicationTestContext.xml looks like this:
<context:component-scan base-package="com.company">
...
<context:exclude-filter expression="com\.company\.xyz\.xEventHandler.java " type="regex"/>
...
</context:component-scan>
however, the class gets entered because of the @Component
annotation(e.g. works, when i delete the @Component
from that class).
how can i fix it?