Punter Vicky
Punter Vicky

Reputation: 16992

Exclude Interceptors added by component-scan

I am including a jar which has a class which has component scan enabled for couple of packages which have interceptors. I want to include this jar and use this class but i dont want the interceptor being scanned to be used and want to define my own interceptor which has to be used. How can I ensure that the interceptor which is part of component scan within a class in the jar is excluded?

Upvotes: 0

Views: 321

Answers (1)

Gaël J
Gaël J

Reputation: 15105

If you have access to the included source JAR, I would recommend to remove component scanning configuration from the JAR. Component scanning should be set at the top most level to avoid these kind of problems, that is in your "final" WAR or JAR.

That said, you still can :

  1. Include all configuration from the JAR and use exclude-filter configuration to exclude all interceptors of a specific package for example
  2. OR do not include configuration from the JAR and rewrite piece of configuration you need

It depends on how much (and what) Spring configuration is included in the JAR.

Upvotes: 1

Related Questions