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 ...
随机推荐
- Web应用架构入门之11个基本要素
译者: 读完这篇博客,你就可以回答一个经典的面试题:当你访问Google时,到底发生了什么? 原文:Web Architecture 101 译者:Fundebug 为了保证可读性,本文采用意译而非直 ...
- 终端复用软件 tmux
Tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权. Tmux 所使用的快捷键前缀默认是组合键 Ctrl-b(同时按下 Ctrl 键和 b 键). 技巧 ...
- python 通过 pip 更新所有已安装的包
较新的 pip 已经支持 list --outdated 了,所以记录一下新的方法: pip list --outdated --format=legacy |awk '{print $1}' |xa ...
- filter(ele)过滤数组
filter也是一个常用的操作,它用于把Array的某些元素过滤掉,然后返回剩下的元素. 例如,在一个Array中,删掉偶数,只保留奇数,可以这么写: function remove(arr) { l ...
- 开源IDE code blocks黑色主题
操作系统:Fedora26 IDE版本: Code Blocks16.01 配置文件路径为: ~/.config/codeblocks 而不像一些教程写的在用户根目录下或者在软件安装目录 请将de ...
- vue.js及项目实战[笔记]— 05 WebPack
一. 历史介绍 1. 规范 AMD Commonjs||CMD UMD 参考:认识AMD.CMD.UMD.CommonJS 2. 工具 npm bower webpack browserify 参考: ...
- Oracle 11gR2_database在Linux下的安装
Oracle 11gR2_database在Linux下的安装 by:授客 QQ:1033553122 由于篇幅问题,采用链接分享的形式,烦请复制以下网址,黏贴到浏览器中打开,下载 http://pa ...
- Java强引用、软引用、弱引用及虚引用深入探讨
强引用.软引用.弱引用和虚引用深入探讨 为了更灵活的控制对象的生命周期,在JDK1.2之后,引用被划分为强引用.软引用.弱引用.虚引用四种类型,每种类型有不同的生命周期,它们不同的地方就在于垃圾回收器 ...
- Linux笔记(二): WIN 10 Ubuntu 双系统
(一) 说明 记录一次ubuntu安装过程及遇到的问题. 环境:WIN 10 单硬盘 (二) ubuntu ISO文件下载 ubuntu 18.04 https://www.ubuntu.com/ ...
- Yii1.1.16学习记录
最近工作中用到Yii框架,为此专门在网上找了些相关教程学一下,尽管教程比较老,但学完后至少对Yii框架有了基本了解,特别是widget的使用,感觉Yii真的很强大. 一.框架介绍与安装 框架源码下载 ...