Ich benutze Spring Boot (v1.5.3.BUILD-SNAPSHOT) Ich bin neu zu Spring Boot.Spring Boot hinzufügen thymeleaf-Layout-Dialekt
gradle
verfügt Hinweis, dass der normale thymeleaf Dialekt gut arbeitet (th ...) Feder-boot-Starter-thymeleaf \ 1.5.3.BUILD-snapshot
Ich möchte thymeleaf hinzufügen -layout-Dialekt habe ich die Abhängigkeit
compile('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect')
die documentation sagt der Dialekt hinzufügen, indem Sie die folgenden Aktionen ausführen
TemplateEngine templateEngine = new TemplateEngine(); // Or
SpringTemplateEngine for Spring config
templateEngine.addDialect(new LayoutDialect());
So habe ich eine Konfigurationsklasse
@Configuration
public class MyConfiguration {
@Bean
public SpringTemplateEngine templateEngine(){
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.addDialect(new LayoutDialect());
return templateEngine;
}
}
aber wenn ich versuche, läuft die App ich folgende Fehlermeldung
org.thymeleaf.exceptions.ConfigurationException: Cannot initialize: no template resolvers have been set
at org.thymeleaf.Configuration.initialize(Configuration.java:203) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.thymeleaf.TemplateEngine.initialize(TemplateEngine.java:827) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:203) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1282) ~[spring-webmvc-4.3.8.BUILD-SNAPSHOT.jar:4.3.8.BUILD-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) ~[spring-webmvc-4.3.8.BUILD-SNAPSHOT.jar:4.3.8.BUILD-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) ~[spring-webmvc-4.3.8.BUILD-SNAPSHOT.jar:4.3.8.BUILD-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.8.BUILD-SNAPSHOT.jar:4.3.8.BUILD-SNAPSHOT]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.8.BUILD-SNAPSHOT.jar:4.3.8.BUILD-SNAPSHOT]
bekommen
kann mir jemand sagen, wie die thymeleaf-Layout-Dialekt hinzuzufügen richtig ?
könnten Sie überprüfen, ob dies hilft: http://stackoverflow.com/questions/43197416/spring-boot-thymeleaf-error-javal-lang-classnotfundexception-org-thymeleaf-do/43203400#43203400 –