大多数情况是真的而没有写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. 一张图弄懂opengl的诸多库gl glu glut freeglut glew glfw之间关系

    开始学习opengl,但是看opengl编程指南不同版本之间使用了一堆不同的库,概念名称全都搅起的,越看越糊涂,遂整理的一下opengl相关的一些库的名词, 才发现是不同时期不同版本不断发展的结果. ...

  2. JavaScript复杂判断的更优雅写法

    摘要: 写代码是一门艺术. 原文:JavaScript 复杂判断的更优雅写法 作者:Think. 公众号:大转转fe Fundebug经授权转载,版权归原作者所有. 前提 我们编写js代码时经常遇到复 ...

  3. FormData对象的使用

    一.概述 FormData类型是XMLHttpRequest 2级定义的,它是为序列化表以及创建与表单格式相同的数据提供便利. 作用:1.利用一些键值对来模拟一系列表单控件:即将form中的所有表单元 ...

  4. 【读书笔记】iOS-多点触摸事件与界面几何

    边缘与中心检测: CGRectGetMinX 返回矩形左边缘的坐标. CGRectGetMinY 返回矩形底部边缘的坐标. CGRectGetMidX 返回矩形中心的x坐标. CGRectGetMid ...

  5. spring配置log4j

    1.引入log4j-xxx.jar包,buildpath. 2.在项目的根目录下新建resources名的文件夹,注意是source folder,并新建log4j.properties文件 3.在l ...

  6. 能用HTML/CSS解决的问题,就不要用JS

    原因:简单. 简单就意味着更快的开发速度,更小的维护成本,同时往往具有更好的体验. 一,导航高亮 效果图: 代码: <!DOCTYPE html> <html lang=" ...

  7. Android jni c/c++线程通过CallVoidMethod调用java函数出现奔溃问题

    最近在移植网络摄像机里的p2p库到android平台,需要用到jni,最近在c线程了调用java函数的时候 出现一个问题,假如在同一个线程调用java函数是没问题的,但在一个c线程了调用java函数就 ...

  8. JavaScript按IP地址排序

    JavaScript按IP地址列表排序,主要思路就是分割每个点号部分,然后ip1和ip2分别对不够三位数的进行补0操作,然后转换为数字类型进行一一比较. 上代码: 正序: var arr=[ {ip: ...

  9. (网页)angular中实现li或者某个元素点击变色的两种方法(转)

    转自脚本之家: 本篇文章主要介绍了angular中实现li或者某个元素点击变色的两种方法,非常具有实用价值,需要的朋友可以参考下 本文介绍了angular中实现li或者某个元素点击变色的两种方法,分享 ...

  10. (网页)JS编程中,有时需要在一个方法返回两个个或两个以上的数据

    转自脚本之家: 1 使用数组的方式,如下: <html> <head> <title>JS函数返回多个值</title> </head> & ...