美文网首页
01.feign及其client helloworld使用

01.feign及其client helloworld使用

作者: 当当一丢丢 | 来源:发表于2023-01-27 10:56 被阅读0次

    使用步骤

    server端定义接口

    • enable激活client-自动将指定package下的client作为bean
    • 定义client 类
    • 使用-通过@Autowire即可注入
    //
    @SpringBootApplication
    @ComponentScan({"com.ppdai.dockeryard"})
    @MapperScan("com.ppdai.dockeryard.core.mapper")
    @EnableFeignClients(basePackages = {"com.ppdai.atlas.api","com.ppdai.atlas"})
    public class ProxyApplication { }
    
    
    
    • 通过swagger自动生成的FeignClient


      image.png

    调用该接口方如何使用

        @Autowired
        AppControllerApiClient appControllerApiClient;
    

    相关文章

      网友评论

          本文标题:01.feign及其client helloworld使用

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