Skip to content

xiejiashuai/spring-jersy-feign

Repository files navigation

Spring Jersy Feign

前言

  • 本项目是基于Feign进行二次开发,旨在帮助使用Jersy框架又不好升级到Spring Boot的开发人员,提供和Spring Cloud Open Feign类似的功能

  • 如有好的建议,请发邮件[email protected]

Quick Start

  • Jersy Resource接口上声明注解

    @RestFeignClient(name="hello-world",url="${service.url}")
    @Path("/hello")
    public interface IHelloWorldResource{
        
        @Path("/world")
        @GET
        public String helloWorld();
        
    }
    • @RestFeignClient注解其他重要属性说明

      • level是配置Feign Logger.Level 日志级别,可选值有如下

         public static enum Level {
                NONE,
                BASIC,
                HEADERS,
                FULL;
           }
      • interceptors是指定Feign的拦截器RequestInterceptor

        必须是RequestInterceptor的实现类

  • @Configuration类中激活

    @EnableRestFeignClients(clients={IHelloWorldResource.class})
    @Configuration
    public class RestFeinClientsConfiguration{
        
    }

    必须能让Spring 能够扫描到RestFeinClientsConfiguration

如上配置,即可实现Rest调用

About

Jersy集成Feign的工程

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages