发布于 2018-12-11 09:55:42
这是因为您在错误的地方使用@ComponentScan。
@ComponentScan
通常,它用于主应用程序类或配置类,而不是定义bean的位置。
请参考以下链接:https://springframework.guru/spring-component-scan/
这里有一个类似的问题,正如您所看到的,它们也在主应用程序中使用@ComponentScan。
How to use @ComponentScan together with test-specific ContextConfigurations in SpringJunit4TestRunner?
https://stackoverflow.com/questions/53721342
相似问题