开发者社区> 问答> 正文

spring使用swagger这个错误怎么解决,项目能运行,就是一直报错误-java报错

spring使用swagger这个错误怎么解决,项目能运行,就是一直报错误。

09:09:55.044 logback [RMI TCP Connection(9)-127.0.0.1] DEBUG s.d.s.w.r.o.OperationResponseClassReader - Setting spring response class to:ServerResponse
09:09:55.044 logback [RMI TCP Connection(9)-127.0.0.1] DEBUG s.d.s.r.o.OperationAuthReader - Authorization count 0 for method resetPassword
09:09:55.046 logback [RMI TCP Connection(9)-127.0.0.1] ERROR s.d.s.r.o.OperationHttpMethodReader - Invalid http method: postValid ones are [[Lorg.springframework.web.bind.annotation.RequestMethod;@5c8bcf2a]
java.lang.IllegalArgumentException: No enum constant org.springframework.web.bind.annotation.RequestMethod.post
    at java.lang.Enum.valueOf(Enum.java:238) ~[na:1.8.0_171]
    at org.springframework.web.bind.annotation.RequestMethod.valueOf(RequestMethod.java:35) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at springfox.documentation.swagger.readers.operation.OperationHttpMethodReader.apply(OperationHttpMethodReader.java:50) ~[springfox-swagger-common-2.4.0.jar:2.4.0]
    at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.operation(DocumentationPluginsManager.java:113) [springfox-spring-web-2.4.0.jar:2.4.0]
    at springfox.documentation.spring.web.readers.operation.ApiOperationReader.read(ApiOperationReader.java:80) [springfox-spring-web-2.4.0.jar:2.4.0]
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:50) [springfox-spring-web-2.4.0.jar:2.4.0]
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:48) [springfox-spring-web-2.4.0.jar:2.4.0]
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628) [guava-20.0.jar:na]
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336) [guava-20.0.jar:na]
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295) [guava-20.0.jar:na]
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208) [guava-20.0.jar:na]

展开
收起
montos 2020-05-28 16:48:48 1324 0
1 条回答
写回答
取消 提交回答
  • 解决:

    将小写post改成大写就好了 或者 @RequestMapping 注解增加 method = RequestMethod.POST

    	@ApiOperation(value="获取所有的区域信息", notes="获取区域列表", httpMethod = "GET", response =Area.class, produces = "application/json")
    	@RequestMapping(value = "/listarea", method = RequestMethod.GET)
    或者
    	@ApiOperation(value="获取所有的区域信息", notes="获取区域列表", httpMethod = "POST", response =Area.class, produces = "application/json")
    	@RequestMapping(value = "/listarea", method = RequestMethod.POST)
    
    2020-05-28 19:43:27
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载