一、
//当配置文件 user.enable=1时才会创建bean,否则不会创建
@ConditionalOnProperty(prefix = "user", name = "enable",havingValue = "1")
二、
@Bean @ConditionalOnMissingBean public HomeService defaultHomeService(){ HomeServiceImpl homeService=new HomeServiceImpl(); return homeService; }
标签:enable,HomeServiceImpl,spring,user,注解,homeService From: https://www.cnblogs.com/raorao1994/p/17541921.html