美文网首页
报扫描路径引起的实体未装配

报扫描路径引起的实体未装配

作者: 什么也不懂888 | 来源:发表于2021-12-13 10:23 被阅读0次

@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

相关文章

  • 报扫描路径引起的实体未装配

    @ComponentScan 扫描指定目录下的 添加了@Controller、@Service、@Reposito...

  • 注解@ComponentScan

    @ComponentScan 的作用就是根据定义的扫描路径,把符合扫描规则的类装配到spring容器中,注解定义如...

  • Spring注解驱动开发

    组件添加 @ComponentScan:定义包扫描路径value:默认,扫描路径excludeFilters:排除...

  • 第二章 装配bean

    装配:创建应用对象之间协作关系的行为 1、自动化装配bean:(组件扫描+自动装配) 在类中使用注解@compon...

  • Spring Bean的装配

      在《Spring 基本使用》一节中,Spring Bean的装配方式是:组件扫描和@Autowired自动装配...

  • 实现自动装配的一个小demo及其原理

    首先说一下情景,很多时候我们可能会做一些小组件,如果不使用自动装配的话,那么是有点麻烦的,需要手动指定扫描的路径,...

  • Spring实战(一)

    一、Spring特点: 二、Spring装配bean 1、如何自动装配 (推荐首选) 第一步:组件扫描(com...

  • 装配bean

    三种装配bean方式 第一种:自动化装配bean · 组件扫描(component scanning):Sprin...

  • spring常用注解-@ComponentScan

    @ComponentScan用法 ComponentScan为组件扫描,就是根据定义的扫描对应路径,把符合扫描规则...

  • spring学习-装配Bean

    一、自动装配 1. 组件扫描 注解启用组件扫描 @Component: 表明该类为组件类,告知Spring要为这个...

网友评论

      本文标题:报扫描路径引起的实体未装配

      本文链接:https://www.haomeiwen.com/subject/wprjfrtx.html