I would like to serve internationalized html pages with my Spring Boot application and I am using Thymeleaf with messages_XX.properties
for i18n. I would prefer accessing these as http://localhost:8080/some/path/test.html and having them in e.g. /src/main/resources/html
but I am unable to configure Spring Boot to process a page using thymeleaf by default.
As a temporary workaround I have a controller with
@RequestMapping(value="**/*.html")
public String serve(HttpServletRequest req) {
String res = req.getRequestURI().substring(0, req.getRequestURI().length() - 5);
res = res.substring(1);
return res;
}
This works for me now: http://localhost:8080/some/path/file.html processes and serves src/templates/some/path/file.html
but can I just configure somewhere that src/resources/html
are to be PROCESSED by thymeleaf and then served?
So far I have tried
spring.thymeleaf.prefix=classpath:/html/
in application.properties
but it does not seemed to work for me.
Environment:
spring-boot-starter-2.0.0.RELEASE
,
spring-webmvc-5.0.4.RELEASE
,
thymeleaf-spring5-3.0.9.RELEASE