From 45ed308851a2dc464861f71ebf78bdbee9a6cce3 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Mon, 5 Oct 2020 23:38:12 +0300 Subject: [PATCH] Implement & enable UrlTemplateResolver for HTML fragment URLs Signed-off-by: Pekka Helenius --- .../com/fjordtek/bookstore/BookstoreApplication.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java b/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java index 99ebb2f..268e065 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/BookstoreApplication.java @@ -13,6 +13,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; +import org.thymeleaf.templateresolver.UrlTemplateResolver; import com.fjordtek.bookstore.model.auth.Role; import com.fjordtek.bookstore.model.auth.RoleRepository; @@ -49,6 +50,14 @@ public class BookstoreApplication extends SpringBootServletInitializer { SpringApplication.run(BookstoreApplication.class, args); } + @Bean + public UrlTemplateResolver urlTemplateResolver() { + UrlTemplateResolver urlTemplateResolver = new UrlTemplateResolver(); + urlTemplateResolver.setCacheable(true); + urlTemplateResolver.getCharacterEncoding(); + return urlTemplateResolver; + } + @Bean public CommandLineRunner userDatabaseRunner( UserRepository userRepository,