【发布时间】:2021-08-26 13:30:30
【问题描述】:
我正在使用 swagger 编辑器中的示例宠物商店学习 swagger:https://editor.swagger.io/
spring 的代码已生成,我没有更改任何内容。但是,每次我在 http://localhost:8080 上运行它时,它都会给出错误消息
This localhost page can’t be found
No webpage was found for the web address: http://localhost:8080/
HTTP ERROR 404
但我相信我应该在以下网站上看到类似的内容: https://petstore.swagger.io/ 请问如何解决这个问题?非常感谢。
我遵循控制器类 HomeController 中的 URL。
@Controller
public class HomeController {
@RequestMapping(value = "/")
public String index() {
System.out.println("swagger-ui.html");
return "redirect:swagger-ui.html";
}
}
【问题讨论】: