已解决:配置了Swagger,但Swagger-ui.html网页打不开

解决方法:在pom中把swagger降级
如果你是3.0.0,降到2.9.2即可,再进入Swagger-ui.html就可以了

		<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
问题: http://localhost:63040/content/swagger-ui.html打不开,该如何解决? 回答: 根据你提供的引用内容,有几种可能的解决方法。首先,你可以检查是否存在/typography.css文件,因为它可能是导致http://localhost:8080/swagger-ui.html无法显示的原因。如果该文件确实不存在,你可以尝试通过添加该文件或修复文件路径来解决此问题。\[1\] 另外,你还可以尝试使用代码来打开浏览器并访问Swagger UI页面。你可以在你的应用程序中添加一个类似于下面的代码段,其中的url变量应该是Swagger UI的URL链接: @Configuration public class XxxApplication { @EventListener({ApplicationReadyEvent.class}) public void ready() { System.out.println("Application is almost started ... opening the browser"); String url = "http://localhost:8080/swagger-ui.html"; Runtime runtime = Runtime.getRuntime(); try { runtime.exec("rundll32 url.dll,FileProtocolHandler " + url); } catch (IOException e) { e.printStackTrace(); } } }\[2\] 另外一种方法是在你的项目中添加一个默认的控制器,将根路径("/")重定向到index.html页面。你可以使用类似于下面的代码来实现这个功能: @Controller @RequestMapping("/") public class DefaultController { @RequestMapping("/") public String index() { return "forward:index.html"; } }\[3\] 希望这些方法能够帮助你解决问题。 #### 引用[.reference_title] - *1* [Empty /swagger-ui.html - 404 /typography.css](https://blog.csdn.net/weixin_39562234/article/details/118172901)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [- 如何访问localhost:8080直接打开swagger-ui界面](https://blog.csdn.net/Sora_Xu/article/details/106436231)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值