Java aop ComponentScan not working & AnnotationConfigApplicationContext getBean not working

后端 未结 3 1799
一个人的身影
一个人的身影 2021-01-14 10:35

I wrote a simple set of classes to show a friend about using Annotations for AOP (instead of xml config) . We couldnt get the @ComponentScan to work AND AnnotationConfigAppl

3条回答
  •  独厮守ぢ
    2021-01-14 11:38

    Question 2

    As you said, bean scanning process was not complete, so there is no bean in context and you should not expect any bean from context, Either @Autowired way or context.getBean way.(Both ways return null )

    Below link has more information on bean scanning(It may help)

    Spring Component Scanning

提交回复
热议问题