I am having some serious issues with my Spring 4 / Thymeleaf setup. This is the error message:
Error resolving template "public/bootstrap/js/bootstrap.min", template might not exist or might not be accessible by any of the configured Template Resolvers
For some reason, Spring or Thymeleaf is treating css and js as if they are not static and trying to process them as if they were a request. I have 3 template resolvers:
@Bean()
public TemplateResolver templateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setOrder(0);
return resolver;
}
@Bean()
public TemplateResolver publicTemplateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/default/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setOrder(1);
return resolver;
}
@Bean()
public TemplateResolver customPublicTemplateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/custom/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setOrder(2);
return resolver;
}
The pages are being served, the only issue is that the css and js is not. I am getting an error for each and every css and js that is included in the .html file. I literally moved a test css file to every possible directory trying to access it, but I am out of ideas at this point. Please let me know what I am doing wrong and if I need to further configure something.
Aucun commentaire:
Enregistrer un commentaire