exclude @Component from @ComponentScan

后端 未结 7 1431
暖寄归人
暖寄归人 2020-11-28 04:10

I have a component that I want to exclude from a @ComponentScan in a particular @Configuration:

@Component(\"foo\") class Foo {
...         


        
相关标签:
7条回答
  • 2020-11-28 04:34

    I needed to exclude an auditing @Aspect @Component from the app context but only for a few test classes. I ended up using @Profile("audit") on the aspect class; including the profile for normal operations but excluding it (don't put it in @ActiveProfiles) on the specific test classes.

    0 讨论(0)
提交回复
热议问题