Spring boot 更改Spring启动模板的默认位置将抛出404

Spring boot 更改Spring启动模板的默认位置将抛出404,spring-boot,thymeleaf,application.properties,Spring Boot,Thymeleaf,Application.properties,当我的index.html位于默认位置(/resource/templates/index.htm)时。一切正常。但当我试图更改默认位置时,它只抛出404。即使更改了应用程序.properties 项目结构 应用程序属性 server.port = 5000 spring.thymeleaf.cache = false spring.thymeleaf.prefix = classpath:/Frontend/public/ 控制器 package iit.kent.cle; im

当我的index.html位于默认位置(/resource/templates/index.htm)时。一切正常。但当我试图更改默认位置时,它只抛出404。即使更改了
应用程序.properties

项目结构

应用程序属性

server.port = 5000
spring.thymeleaf.cache = false
spring.thymeleaf.prefix = classpath:/Frontend/public/
控制器

    package iit.kent.cle;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class RouteController {

    @RequestMapping("/[^api]")
    public String index() {
        return "index" ;
    }

}

应更新application.properties根上的前缀,根位于参考资料中,因此类路径从以下位置开始:

spring.thymeleaf.prefix = classpath:/templates/Frontend/public/

应更新application.properties根上的前缀,根位于参考资料中,因此类路径从以下位置开始:

spring.thymeleaf.prefix = classpath:/templates/Frontend/public/

您应该更改spring.thymeleaf.prefix=classpath:/templates/Frontend/public/。请试试看。作品现在JS,CSS确实加载了。酷,我创建了一个关于它的答案,请我希望我的答案标记为有用:)xD。亲切问候。您应该更改spring.thymeleaf.prefix=classpath:/templates/Frontend/public/。请试试看。作品现在JS,CSS确实加载了。酷,我创建了一个关于它的答案,请我希望我的答案标记为有用:)xD。亲切的问候。