[英]Mapping error Thymeleaf Spring Boot Security app, doesn't load templateS
[英]Spring boot doesn't identify html templates without Thymeleaf dependency
我使用 spring-boot 2.5.0 和 maven 作為依賴管理工具。 到目前為止,我的項目中有以下依賴項。
"<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>"
I want to use jsp instead of thymeleaf but when I put my "index.html" file inside templates or static sub-folder of resources folder it doesn't recognize the html file and throws white label error.When I added the thymeleaf dependency it工作完美並識別 html 文件。 那么,我應該怎么做才能讓 spring-boot 檢測到我的 html 文件而不添加 thymeleaf 依賴項。 順便說一句,我以前從未使用過 jsp。
看來您缺少這兩件事中的任何一件。
您應該在屬性/yaml 文件中將所需值放在屬性下方
spring.mvc.view.prefix: <html/jsp的位置>
spring.mvc.view.suffix:<.extension>
檢查您的 controller 是否發送正確的視圖名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.