【发布时间】:2017-04-19 19:38:44
【问题描述】:
我将继续使用 this article 构建一个 Restful 应用程序,然后使用 this link 向其中添加 swagger2 来启动一个 Spring boot Restful 项目。在second link 中,它说您可以通过访问“http://localhost:8080/your-app-root/swagger-ui.html”在浏览器中测试 swagger-ui。我的项目中的 app-root 是什么?是项目名称吗?我的项目名称是 RestSpringBoot。我试过 "http://localhost:8080/RestSpringBoot/swagger-ui.html" 。但我收到以下错误:
白标错误页面
此应用程序没有显式映射 /error,因此您将其视为后备。
更新:我使用 intellij IDE,并在配置中进行了配置,以使用 sring boot 运行我的项目。当我运行项目并检查 url http://localhost:8080/ 它给出了同样的错误。但是这个:http://localhost:8080/persons/all 将返回一个用户的 json。是不是spring boot本身就内嵌了tomcat,因此不需要启动tomcat或者在tomcat上部署项目?如果是真的,为什么通过 Spring Boot 运行项目访问 http://localhost:8080 会给出“Whitelabel Error Page”错误。
更新 2:当我的 spring boot 项目运行时,我打开这个 url:http://localhost:8080/swagger-ui.html 但我看不到控制器列表,而是看到这个页面:
我无法理解的是,当我的项目没有运行时,我再次在http://localhost:8080/swagger-ui.html 中看到与上图相同的内容。
【问题讨论】:
标签: java tomcat spring-boot swagger swagger-ui