swagger报错No handler found for GET /swagger-ui.html
今天下载jeeweb框架下来研究,其他还有,就是swagger老是出不来。报错:No handler found for GET /swagger-ui.html

后来搜索才发现,这个错误,是因为资源映射问题导致的。
我们在访问http://127.0.0.1:8188/swagger-ui.html 时,这个swagger-ui.html相关的所有前端静态文件都在springfox-swagger-ui-2.8.jar里面。目录如下:

Spring Boot自动配置本身不会自动把/swagger-ui.html这个路径映射到对应的目录META-INF/resources/下面。我们加上这个映射即可。代码如下:
@Configuration
class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/") registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/")
}
}

添加好后,重启,成功!

swagger报错No handler found for GET /swagger-ui.html的更多相关文章
- Swagger 报错 no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet with name '***'
swagger报错: no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet wi ...
- Mvc Swagger报错的解决办法。
报错信息:Not supported by Swagger 2.0: Multiple operations with path ‘xxxx.aspx’ and method 'POST' 解决办法出 ...
- springboot启动报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError
最近在用springboot构建项目,控制台报错:Handler dispatch failed; nested exception is java.lang.AbstractMethodError, ...
- 由ASP.NET Core WebApi添加Swagger报错引发的探究
缘起 在使用ASP.NET Core进行WebApi项目开发的时候,相信很多人都会使用Swagger作为接口文档呈现工具.相信大家也用过或者了解过Swagger,这里咱们就不过多的介绍了.本篇文章记录 ...
- swagger 报错:illegal defaultValue null for param type integer
swagger(版本2.9.2) 刷新报错,错误信息如下图: 问题原因: 根据上面这句报错信息,点进去AbstractSerializableParameter.java:412可以看到 源码, @J ...
- Spring Boot整合Swagger报错:"this.condition" is null
前段时间看到群里有吐槽swagger整合问题,当时没仔细看,总以为是姿势不对. 这两天正好自己升级Spring Boot版本,然后突然出现了这样的一个错误: Caused by: java.lang. ...
- MyBatis报错—Type handler was null on parameter mapping for property 'createTime'. It was either not specified and/or could not be found for the javaType (javax.xml.crypto.Data) : jdbcType (null) combina
原因是:在创建实体类的时候吧date类型写成data导致类型不匹配 Type handler was null on parameter mapping for property 'createTim ...
- 关于spring boot在启动的时候报错: java.lang.Error: generate operation swagger failed, xxx.xxx.xxx
Error starting ApplicationContext. To display the auto-configuration report re-run your application ...
- swagger 报错打不开
1.controller中的接口里使用的 qto的数据类型有问题: qo中的字段中缺少:(@JsonProperty(value = "sort"),以及定义的example值的格 ...
随机推荐
- POJ-2777 Count Color(线段树,区间染色问题)
Count Color Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 40510 Accepted: 12215 Descrip ...
- ResourceManager High Availability
Introduction This guide provides an overview of High Availability of YARN’s ResourceManager, and det ...
- time out 超时
网络不通:比如代理服务拒绝连接 网络ok,但是数据量过大,传输超时
- a new way of thinking about a problem
PHP Advanced and Object-Oriented Programming Larry Ullman The first thing that you must understand ...
- 6.2.3 Property Access Errors
JavaScript: The Definitive Guide, Sixth Edition by David Flanagan Property access expressions do n ...
- lamp docker apache2 supervisor monitor
sudo docker run -d -p 80:80 -p 3306:3306 -v /data/lampp/supervisormonitor:/app --name mylamp01 tutum ...
- Java Hash Collision之数据生产
上一篇文章一种高级的DoS攻击-Hash碰撞攻击我通过伪造Hash Collision数据实现了对Java的DoS攻击,下面说说如何生产大量的攻击数据. HashTable是一种非常常用的数据结构.它 ...
- PHP程序员应该知道的15个库
最几年,PHP已经成为最受欢迎的一种有效服务器端编程语言.据2013年发布的一份调查报告显示,PHP语言已经被安装在全球超过2.4亿个网站以及210万台Web服务器之上.PHP代表超文本预处理器,它主 ...
- flask_SQLAlchemy常用数据类型及列选项
SQLAlchemy常用数据类型:1. Integer:整形,映射到数据库中是int类型.2. Float:浮点类型,映射到数据库中是float类型.他占据的32位.3. Double:双精度浮点类型 ...
- npm的用户名添加不上的原因
npm添加不上的错误e401 1.用cnpm提交,会提交的tao.org这个域名了,用npm提交试试 2.如果npm提交不上,那就查看配置文件配置中 registry=http://registry. ...