在1中随意写code ,

在 2中 会提示

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: No matching constant for [1]
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2214)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
    at springfox.documentation.spring.web.scanners.CachingOperationReader.read(CachingOperationReader.java:57)
    at springfox.documentation.spring.web.scanners.ApiDescriptionReader.read(ApiDescriptionReader.java:70)
    at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:89)
    at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:69)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:105)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:91)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:53)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:298)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.JettyRunMojo.restartWebApp(JettyRunMojo.java:435)
    at org.mortbay.jetty.plugin.JettyRunMojo$1.filesChanged(JettyRunMojo.java:394)
    at org.eclipse.jetty.util.Scanner.reportBulkChanges(Scanner.java:691)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:551)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:403)
    at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:353)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.IllegalArgumentException: No matching constant for [1]
    at org.springframework.http.HttpStatus$Series.valueOf(HttpStatus.java:524)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.isSuccessful(SwaggerResponseMessageReader.java:148)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.read(SwaggerResponseMessageReader.java:105)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.apply(SwaggerResponseMessageReader.java:74)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.operation(DocumentationPluginsManager.java:113)
    at springfox.documentation.spring.web.readers.operation.ApiOperationReader.read(ApiOperationReader.java:80)
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:50)
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:48)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
    ... 36 more
[WARNING] Failed startup of context o.m.j.p.JettyWebAppContext{/,[file:/E:/homeGit/zhangbaowei/home-news/autonews-webapi/src/main/webapp/, jar:file:/D:/JavaTools/maven/my_local_repository/io/springfox/springfox-swagger-ui/2.4.0/springfox-swagger-ui-2.4.0.jar!/META-INF/resources/]},file:/E:/homeGit/zhangbaowei/home-news/autonews-webapi/src/main/webapp/
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: No matching constant for [1]
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2214)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
    at springfox.documentation.spring.web.scanners.CachingOperationReader.read(CachingOperationReader.java:57)
    at springfox.documentation.spring.web.scanners.ApiDescriptionReader.read(ApiDescriptionReader.java:70)
    at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:89)
    at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:69)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:105)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:91)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:53)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:298)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.mortbay.jetty.plugin.JettyRunMojo.restartWebApp(JettyRunMojo.java:435)
    at org.mortbay.jetty.plugin.JettyRunMojo$1.filesChanged(JettyRunMojo.java:394)
    at org.eclipse.jetty.util.Scanner.reportBulkChanges(Scanner.java:691)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:551)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:403)
    at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:353)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.IllegalArgumentException: No matching constant for [1]
    at org.springframework.http.HttpStatus$Series.valueOf(HttpStatus.java:524)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.isSuccessful(SwaggerResponseMessageReader.java:148)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.read(SwaggerResponseMessageReader.java:105)
    at springfox.documentation.swagger.readers.operation.SwaggerResponseMessageReader.apply(SwaggerResponseMessageReader.java:74)
    at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.operation(DocumentationPluginsManager.java:113)
    at springfox.documentation.spring.web.readers.operation.ApiOperationReader.read(ApiOperationReader.java:80)
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:50)
    at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:48)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
    ... 36 more

原来, 2中的 code 与 httpstatus 挂钩了,所以,只能写 httpstaus 相关的 code

  @ApiResponses(value = {
 
             @ApiResponse(code = 500, message = "成功"),  // 正确的
@ApiResponse(code = 302, message = "过一会儿再发"), // 正确的
// @ApiResponse(code = 2, message = "超过限定次数"), // 这个就是错误的了
})

ApiResponse 在 Swagger 1 和Swagger 2中的不同的更多相关文章

  1. Swagger UI及 Swagger editor教程 API文档搭配 Node使用

    swagger ui 是一个在线文档生成和测试的利器,目前发现最好用的.为啥好用呢?打开 demo,支持API自动生成同步的在线文档些文档可用于项目内部API审核方便测试人员了解 API这些文档可作为 ...

  2. SpringMVC集成Swagger插件以及Swagger注解的简单使用

    一.简介 Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新 .接口的方法,参数和模型 ...

  3. swagger.yaml转换为swagger.json文件

    方法一 swagger-editor页面 官方的 swagger-editor Live Demo (在线直接使用,就是访问的有点慢)或者将swagger-editor Download 下载到本地然 ...

  4. swagger core 和 swagger ui 如何关联【窥探】

    几个片段: package io.swagger.jaxrs.listing; import io.swagger.annotations.ApiOperation; import org.apach ...

  5. 【swagger】1.swagger提供开发者文档--简单集成到spring boot中【spring mvc】【spring boot】

    swagger提供开发者文档 ======================================================== 作用:想使用swagger的同学,一定是想用它来做前后台 ...

  6. swagger集成到springBoot 项目中

    1 pom 文件加包依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>spring ...

  7. 【swagger学习】.net WebApi中使用swagger

    我在WebApi中使用swagger的时候发现会出现很多问题,搜索很多地方都没找到完全解决问题的方法,后面自己解决了,希望对于遇到同样问题朋友有帮助.我将先一步一步的演示项目中解决swagger遇到问 ...

  8. Miniprofiler在swagger、vue、angular中的使用

     本篇分为以下几个部分: 1.Swagger的简单应用 2.Miniprofier的后台配置 3.跨域配置 4.在angular中显示Miniprofier 5.在vue中显示Miniprofier ...

  9. swagger请求参数在header中添加token

    网友大部分说的是如下配置 参照配置然而没有作用 注掉改红框内的配置,在方法上加如下注释就可以用 @ApiImplicitParams({ @ApiImplicitParam(paramType = & ...

随机推荐

  1. jsp中的正则表达式

    sp中${}----是EL表达式的常规表示方式目的是为了获取{}中指定的对象(参数.对象等)的值如:${user.name}<====>User user = (User)request( ...

  2. Allegro padstack

    在ALLEGRO中,建立PCB封装是一件挺复杂的事,而要建立FOOTPRINT,首先要有一个PAD,所以就要新建PADSTACK. 焊盘可以分两种,表贴焊盘和通孔焊盘,表贴焊盘结构相对简单,下面首先分 ...

  3. 北大poj- 1028

    Web Navigation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 33281   Accepted: 14836 ...

  4. 六大免费网站数据采集器对比(火车头,海纳,云采集,ET,三人行,狂人采集)

    2013年02月27日 PHP开源系统 暂无评论 阅读 497 views 次 在目前的站长圈内,比较流行的采集工具有很多,但是总结起来,比较出名的免费的就这么几个:火车头,海纳,云采集,ET,三人行 ...

  5. Android在外部存储空间中读写文件

    一.外部存储的目录 1.2.3之前是/sdcard 2.4.3之前是在/mnt/sdcard 3.4.3之后是在/storage/sdcard 二.读写读写外部存储 1.直接写路径 File file ...

  6. android SDK 更新问题解决

    Android在win7更新SDK时出现问题: Download interrupted: hostname in certificate didn't  match: <dl-ssl.goog ...

  7. 服务器列表里找不到OracleOraDb10g_home1TNSListener

    先安装的ORACLE DB,后配置的数据库,TNSNAMES.ORA, LISTENER.ORA配置完毕,客户端连接不上TNS服务器,发现服务列表里没有OracleOraDb10g_home1TNSL ...

  8. 对Ajax的理解

    一.Ajax的工作原理: 1. Ajax的机制是:完成异步请求,实现页面的局部刷新. 2. 发送异步请求:通过xmlhttprequest方法. 3. 浏览器向服务器发送异步请求: 服务器接收处理请求 ...

  9. matlab mesh visualization

    1. matlab color specification http://au.mathworks.com/help/matlab/ref/colorspec.html

  10. Photoshop制作的海报修改~

    经过几天的征求意见,感觉还是要重新制作,于是把颜色删减了不少 . 这次运用了蒙版和渐变,但感觉效果不太好.再改.. 后来觉得给人的单身感有点少.. 不知道感觉如何,但自己觉得比以前好看..