[英]Unable to display index.html in jax rs with spring boot
我正在尝试使用 jax rs、springboot、angular 创建一个简单的应用程序。
我已将 index.html 放在静态文件夹中,但是在访问 url localhost:8080/index.html 或 localhost:8080 时,它通过自定义异常处理程序抛出 404 not found 错误。 我已将 index.html 添加为欢迎文件列表。
我有一个控制器类,但我没有编写任何特定的方法来处理它。
我还想显示带有消息详细信息的错误特定页面。
肯定我错过了一些东西,但没有得到任何指针来找到它。 请帮忙。
我需要为此明确配置 web.xml 吗?
添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
到你的 pom.xml 文件,spring boot 自动配置所有其余的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.