大多数情况是真的而没有写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) 问题解决的更多相关文章

  1. java.lang.IllegalStateException: Method get not annotated with HTTP method type (ex. GET, POST);

    明明指定了请求方法类型还报错: 代码: @RequestMapping(value="/enterprise/detail",method = RequestMethod.POST ...

  2. 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 ...

  3. ES5 function & ES6 class & method type

    ES5 function & ES6 class & method type ES5 function "use strict"; /** * * @author ...

  4. Spring.net Could not load type from string value问题解决办法

    Spring.net Could not load type from string value "xxx" 错误原因可能有: 1.spring.net配置错误,注意要区别配置文件 ...

  5. cannot be resolved to a type in same package 问题解决

    在 STS 上,一个类引用在相同 package 中另一个类,但是报 cannot be resolved to a type 错误. 解决方法 : Alternatively, you can hi ...

  6. C# Type.GetType 返回NULL 问题解决记录

    Type.GetType("OP.Client.Html.Resources.KenFengFormMethod"); 从Dll里面获取KenFengFormMethod这个会返回 ...

  7. spring cloud Feign 使用 @RequestLine 注解遇到的问题

    package com.itmuch.cloud; import org.springframework.cloud.netflix.feign.FeignClient; import com.itm ...

  8. spring cloud 使用feign 遇到问题

    spring cloud 使用feign 项目的搭建 在这里就不写了,本文主要讲解在使用过程中遇到的问题以及解决办法 1:示例 @RequestMapping(value = "/gener ...

  9. Feign-手动创建FeignClient

    前言 在<Feign-请求不同注册中心的服务>中,提到,如果需要请求不同注册中心的服务,可以设置@FeignClient的url属性. 这种做法有个缺点,需要服务消费者,配置各个环境的ur ...

随机推荐

  1. 10种JavaScript开发者必备的VS Code插件

    摘要: 好的代码插件可以让工作效率翻倍,心情也更加舒畅! 原文:10 Must-have VS Code Extensions for JavaScript Developers 作者:Michael ...

  2. MySQl创建用户和授权

    权限的管理: 如何创建用户和密码 给当前的用户授权 移除当前用户的权限 首先进去到mysql数据库下: mysql> use mysql Database changed 其次, 对新用户进行增 ...

  3. 2017-11-20 中文代码示例之Vuejs入门教程(一)问题后续

    "中文编程"知乎专栏原文 第一个issue: Error compiling template if using unicode naming as v-for alias · I ...

  4. python总结(更新中)

    1 python函数中的参数传递(注意可变和不可变传递) 可更改(mutable)与不可更改(immutable)对象 在 python 中,strings, tuples, 和 numbers 是不 ...

  5. 二层协议--LLDP协议总结

    二层协议--LLDP协议总结,待完善.

  6. SoapUI 利用SoapUI进行简单的接口并发测试

    利用SoapUI进行简单的接口并发测试 by:授客 QQ:1033553122 测试环境: SoapUI Pro 5.1.2 步骤如下 1.   把请求添加到测试套件 1.1.     途径1 1.新 ...

  7. 安卓开发_浅谈TimePicker(时间选择器)

    TimePicker也继承自FrameLayout类.时间选择控件向用户显示一天中的时间(可以为24小时,也可以为AM/PM制),并允许用户进行选择.如果要捕获用户修改时间数据的事件,便需要为Time ...

  8. Yii1.1.16学习记录

    最近工作中用到Yii框架,为此专门在网上找了些相关教程学一下,尽管教程比较老,但学完后至少对Yii框架有了基本了解,特别是widget的使用,感觉Yii真的很强大. 一.框架介绍与安装 框架源码下载 ...

  9. [20180403]访问dba_autotask_task无输出问题.txt

    [20180403]访问dba_autotask_task无输出问题.txt --//链接http://www.itpub.net/thread-1911421-1-1.html的讨论,还没注意原先的 ...

  10. 鸟哥的 Linux 私房菜Shell Scripts篇(二)

    参考: http://linux.vbird.org/linux_basic/0340bashshell-scripts.php#script_be http://www.runoob.com/lin ...