Bean 'x' of type [TYPE] is not eligible for getting processed by all BeanPostProcessors

后端 未结 1 802
半阙折子戏
半阙折子戏 2021-01-27 10:23

I have a ResourceAspect class:

//@Component
@Aspect
public class ResourceAspect {

    @Before(\"execution(public * *(..))\")
    public void resour         


        
1条回答
  •  有刺的猬
    2021-01-27 11:09

    My guess is that your pointcut execution(* *(..)) (which basically says "intercept the world") affects too many components, even Spring-internal ones. Just limit it to the classes or packages you really want to apply your aspect to, e.g.

    execution(* my.package.of.interest..*(..))
    

    or

    within(my.package.of.interest..*) && execution(* *(..))
    

    You could also exclude the ones you don't need woven if that is easier to specify:

    !within(my.problematic.ClassName) && execution(* *(..))
    

    or

    !within(my.problematic.package..*) && execution(* *(..))
    

    BTW, of course your aspect needs to be a @Component when using Spring AOP (not AspectJ).

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