2020年9月26日 | Leave a comment 感觉不太靠谱 没找到良好的文档,关键容易不适配(服务器与客户端有一样的定义,出现参数无法传) @FormParam 配置 Feign.builder() .decoder(new JacksonDecoder()) .encoder(new JacksonEncoder()) .contract(new JAXRS2Contract()) .logger(new Slf4jLogger()) .logLevel(feign.Logger.Level.BASIC) .target(OrderResource.class, baseUrl);//baseUrl 不是 Resource 的路径,应该是类似 http://ws.aa.com/ ; OrderResource path="/order" 1234567 Feign.builder() .decoder(new JacksonDecoder()) .encoder(new JacksonEncoder()) .contract(new JAXRS2Contract()) .logger(new Slf4jLogger()) .logLevel(feign.Logger.Level.BASIC) .target(OrderResource.class, baseUrl);//baseUrl 不是 Resource 的路径,应该是类似 http://ws.aa.com/ ; OrderResource path="/order" 2. pom.xml <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-core</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-jaxrs2</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-jackson</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-slf4j</artifactId> <version>10.1.0</version> </dependency> 12345678910111213141516171819202122232425 <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-core</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-jaxrs2</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-jackson</artifactId> <version>10.1.0</version> </dependency> <dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-slf4j</artifactId> <version>10.1.0</version> </dependency> 参考 https://github.com/OpenFeign/feign https://github.com/OpenFeign/feign/tree/master/jaxrs2