CompantScan 今天碰到问题记录

@EnableFeignClients(basePackages = {"com.gwm.lafeng.feign.uc", "com.gwm.lafeng.feign.authcenter","com.gwm.lafeng.lovecar"})
@EnableTransactionManagement
@SpringCloudApplication
@EnableScheduling
//@ComponentScan(value = {"com.gwm.lafeng.lovecar","com.gwm.lafeng.component"})
@ServletComponentScan(basePackageClasses = {LafengDingdingConfigurer.class})
public class LoveCarApplication{
}

项目今天启动时候,一直报异常:

ConfigurationClassPostProcessor.importRegistry available

 

   项目里面有个使用了@Lazy的bean,所以启动没有报错。但是每次调用这个含有@lazy的bean时候,就包异常了。说bean注入失败。

  最后发现是因为 @ComponentScan去掉了的缘故。不明白为啥?

posted @ 2022-04-19 17:02  Doyourself!  阅读(51)  评论(0编辑  收藏  举报