2015-04-06 17 views
7

mam multi strukturę projektu moduł jak:Wiosna-boot plik HTML obciążenie thymeleaf od ścieżki klasy

- application (parent module) 
--- boot (web-app) 
----- src/main/resources/templates/layout.html 

---- todo (jar file) 
----- src/main/resources/templates/home.html 

i na moim kontrolera:

@RequestMapping(value = "/home") 
public String home() { 
    return "todo/home"; 
} 

dostaję komunikat o błędzie, jak poniżej :

Error resolving template "todo/home", template might not exist or 
might not be accessible by any of the configured Template 
Resolvers] 

Czy istnieje konfiguracja, aby skonfigurować coś specjalnie na wiosnę do wyszukiwania szablonów na ścieżce zajęć?

UPDATE

rozwiązany. Dodając następujące właściwości rozwiązuje mój problem:

spring.thymeleaf.check-template-location=true 
spring.thymeleaf.prefix=classpath:/templates/ 
spring.thymeleaf.suffix=.html 
spring.thymeleaf.mode=LEGACYHTML5 
spring.thymeleaf.encoding=UTF-8 
spring.thymeleaf.content-type=text/html 
spring.thymeleaf.cache=false 
+1

mógł zamieścić swoje aktualizację jako odpowiedź na to pytanie i przyjmuję je –

Odpowiedz

8

dodając następujące właściwości rozwiązuje mój problem:

spring.thymeleaf.check-template-location=true 
spring.thymeleaf.prefix=classpath:/templates/ 
spring.thymeleaf.suffix=.html 
spring.thymeleaf.mode=LEGACYHTML5 
spring.thymeleaf.encoding=UTF-8 
spring.thymeleaf.content-type=text/html 
spring.thymeleaf.cache=false 
Powiązane problemy