简体   繁体   English

Spring Boot 1.5.6找不到index.html

[英]Spring Boot 1.5.6 doesn't find index.html

I am trying to connect index.html to my spring boot app to make localhost:8080 return it. 我正在尝试将index.html连接到我的spring boot应用程序,以使localhost:8080返回它。

I have already tried various ways and I always get 404. Here is the part of my application.properties 我已经尝试了各种方法,但总是得到404。这是我的application.properties的一部分

server.context-path=/
spring.mvc.static-path-pattern=/resources/**
spring.resources.add-mappings=true

index.html is in src/main/resources/static directory. index.html在src / main / resources / static目录中。 Can usage of Apache CXF for REST API somehow affect it? 可以将REST API的Apache CXF的使用以某种方式影响它吗?

  • Delete this properties, you don't need them. 删除此属性,则不需要它们。
  • make sure you don't have @EnableWebMvc annotation anywhere. 确保您在任何地方都没有@EnableWebMvc批注。
  • if you run your application from jar, you should have configured spring-boot-maven-plugin in your pom. 如果从jar运行应用程序,则应该在pom中配置spring-boot-maven-plugin。

  • if you run your application from IDE, try to rebuild your project. 如果您从IDE运行应用程序,请尝试重建项目。

    It is hard to tell what can be wrong. 很难说出什么是错的。 If nothing helps, you should start a new project from: https://start.spring.io/ and if it also will not work, then we should look for the problem somewhere else. 如果没有帮助,则应该从以下位置开始一个新项目: https : //start.spring.io/如果它也无法正常工作,那么我们应该在其他地方查找问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM