not annotated with HTTP method type (ex. GET, POST) 问题解决
大多数情况是真的而没有写method = RequestMethod.GET、POST等注解, 有时这么写了也报类似异常,如下
@FeignClient("microservice-provider-user")
public interface MyFeignClient {
@RequestMapping(value = "a",method = RequestMethod.GET)
public User findByIdE(@RequestParam("id") Long id);
@RequestMapping(method = RequestMethod.POST,value = "/getUserByPost")
User findBy(@RequestBody User user);
}
java.lang.IllegalStateException: Method findByIdE not annotated with HTTP method type (ex. GET, POST)
问题原因,是因为这个类的存在,在其中 new feign.Contract.Default();使用了默认的Contract导致。
package com.itmuch.cloud.study.user.feign;
import feign.Contract;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyFeignConfiguration {
@Bean
public Contract feignContract(){
return new feign.Contract.Default();
}
@Bean
public Logger.Level logLevel(){
return Logger.Level.FULL;
}
}
解决方法:换其他Contract.
not annotated with HTTP method type (ex. GET, POST) 问题解决的更多相关文章
- java.lang.IllegalStateException: Method get not annotated with HTTP method type (ex. GET, POST);
明明指定了请求方法类型还报错: 代码: @RequestMapping(value="/enterprise/detail",method = RequestMethod.POST ...
- Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method getMemberInfo not annotated with HTTP method type (ex. GET, POST)
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ord ...
- ES5 function & ES6 class & method type
ES5 function & ES6 class & method type ES5 function "use strict"; /** * * @author ...
- Spring.net Could not load type from string value问题解决办法
Spring.net Could not load type from string value "xxx" 错误原因可能有: 1.spring.net配置错误,注意要区别配置文件 ...
- cannot be resolved to a type in same package 问题解决
在 STS 上,一个类引用在相同 package 中另一个类,但是报 cannot be resolved to a type 错误. 解决方法 : Alternatively, you can hi ...
- C# Type.GetType 返回NULL 问题解决记录
Type.GetType("OP.Client.Html.Resources.KenFengFormMethod"); 从Dll里面获取KenFengFormMethod这个会返回 ...
- spring cloud Feign 使用 @RequestLine 注解遇到的问题
package com.itmuch.cloud; import org.springframework.cloud.netflix.feign.FeignClient; import com.itm ...
- spring cloud 使用feign 遇到问题
spring cloud 使用feign 项目的搭建 在这里就不写了,本文主要讲解在使用过程中遇到的问题以及解决办法 1:示例 @RequestMapping(value = "/gener ...
- Feign-手动创建FeignClient
前言 在<Feign-请求不同注册中心的服务>中,提到,如果需要请求不同注册中心的服务,可以设置@FeignClient的url属性. 这种做法有个缺点,需要服务消费者,配置各个环境的ur ...
随机推荐
- 解决Linux服务器tomact-8.0启动慢的问题
环境信息: CentOS release 6.8 tomcat-8.0 JDK1.8 一.启动tomcat #sh /root/tomcat-8.0/bin/startup.sh #tailf /ro ...
- python中收集函数的解包问题
收集参数的解包问题 - 把参数放入list或者字典中,直接把list/dict中的值放入收集参数中- 语法:参照案例 # 收集参数的问题 def stu(*args): print("=&q ...
- 2017-12-02 编程语言试验之Antlr4+JavaScript实现"圈4"
参考: ANTLR4: Making a compiler with the JavaScript runtime 演示效果虽弱, 还是先上图吧: 在线演示: 地址. 源码库: program-in- ...
- 【代码笔记】Web-手机端的meta
一,天猫 <title>天猫触屏版</title> <meta content="text/html; charset=utf-8" http-equ ...
- 解决ie7,ie8下a链接无效问题
.person a{ display: block; position: absolute; width: 109px; height: 33px; bottom: 19px; right: 40px ...
- 《Inside C#》笔记(十五) 非托管代码 上
为了保证向后兼容性,C#和.NET可以通过非托管的方式运行旧代码.非托管代码是指没有被.NET运行时管控的代码.非托管代码主要包括:平台调用服务(PlatformInvocation Services ...
- idea 自动换行
如下:
- 慕学在线网0.5_xadmin的全局配置
全局配置包括了以下修改: 开启主题功能: 修改左上角的"django Xadmin"和主界面的"我的公司": App菜单收叠: App名字修改(汉化). 1.把 ...
- Docker容器服务发现方案
一. 目的 在服务在容器中部署时,外部调用服务需要知道服务接口ip及端口号,这样导致部署时需要配置,从而增加部署的困难.本文档主要介绍如何使用ningx反向代理和consul进行自动化服务发 ...
- 12-openldap使用AD密码
阅读视图 本文严重参考 Openldap 整合windows AD认证 本文其他参考 OpenLDAP使用AD密码 Configuring OpenLDAP pass-through authenti ...