@ComponentScan 扫描指定目录下的 添加了@Controller、@Service、@Repository注解的类;
如果要扫描FeignClient注解的实体,需要添加 @EnableFeignClients注解。
如:
@ComponentScan(basePackages = {"com.huimeihealth.crm.dailyreportquery", "com.huimeihealth.crm.api"})
只扫描这2个包下的@Controller、@Service、@Repository。
而如果要扫描用@FeignClient注解的类,如:
@FeignClient(value ="crm-account-service", path ="/hm/tenant", fallbackFactory = AccountServiceFallbackFactory.class)
public interface HmAccountService {
@GetMapping(value ="/accountHcp/{id}")
ResponseEntityhcpById(@PathVariable("id") Long id, Long territoryId);
}
则需要使用@EnableFeignClient