|
1 | 1 | package org.springframework.webflow.samples.booking.config; |
2 | 2 |
|
3 | | -import java.util.LinkedHashSet; |
4 | | -import java.util.Set; |
5 | | - |
6 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
7 | 4 | import org.springframework.context.annotation.Bean; |
8 | 5 | import org.springframework.context.annotation.Configuration; |
9 | 6 | import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; |
10 | 7 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
11 | 8 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
12 | 9 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; |
13 | | -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| 10 | +import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; |
| 11 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| 12 | +import org.springframework.web.servlet.view.tiles3.TilesConfigurer; |
14 | 13 | import org.springframework.webflow.mvc.servlet.FlowHandlerAdapter; |
15 | 14 | import org.springframework.webflow.mvc.servlet.FlowHandlerMapping; |
| 15 | +import org.springframework.webflow.mvc.view.AjaxUrlBasedViewResolver; |
| 16 | +import org.springframework.webflow.mvc.view.FlowAjaxTiles3View; |
16 | 17 | import org.springframework.webflow.samples.booking.BookingFlowHandler; |
17 | | -import org.thymeleaf.dialect.IDialect; |
18 | | -import org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect; |
19 | | -import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect; |
20 | | -import org.thymeleaf.extras.tiles2.dialect.TilesDialect; |
21 | | -import org.thymeleaf.extras.tiles2.spring4.web.configurer.ThymeleafTilesConfigurer; |
22 | | -import org.thymeleaf.extras.tiles2.spring4.web.view.FlowAjaxThymeleafTilesView; |
23 | | -import org.thymeleaf.spring4.SpringTemplateEngine; |
24 | | -import org.thymeleaf.spring4.view.AjaxThymeleafViewResolver; |
25 | | -import org.thymeleaf.templateresolver.ServletContextTemplateResolver; |
26 | 18 |
|
27 | 19 | @EnableWebMvc |
28 | 20 | @Configuration |
29 | | -public class WebMvcConfig extends WebMvcConfigurerAdapter { |
| 21 | +public class WebMvcConfig implements WebMvcConfigurer { |
30 | 22 |
|
31 | 23 | @Autowired |
32 | 24 | private WebFlowConfig webFlowConfig; |
@@ -70,38 +62,15 @@ public BookingFlowHandler BookingFlowHandler() { |
70 | 62 | } |
71 | 63 |
|
72 | 64 | @Bean |
73 | | - public AjaxThymeleafViewResolver tilesViewResolver() { |
74 | | - AjaxThymeleafViewResolver viewResolver = new AjaxThymeleafViewResolver(); |
75 | | - viewResolver.setViewClass(FlowAjaxThymeleafTilesView.class); |
76 | | - viewResolver.setTemplateEngine(templateEngine()); |
77 | | - return viewResolver; |
78 | | - } |
79 | | - |
80 | | - @Bean |
81 | | - public SpringTemplateEngine templateEngine(){ |
82 | | - |
83 | | - Set<IDialect> dialects = new LinkedHashSet<IDialect>(); |
84 | | - dialects.add(new TilesDialect()); |
85 | | - dialects.add(new SpringSecurityDialect()); |
86 | | - dialects.add(new ConditionalCommentsDialect()); |
87 | | - |
88 | | - SpringTemplateEngine templateEngine = new SpringTemplateEngine(); |
89 | | - templateEngine.setTemplateResolver(templateResolver()); |
90 | | - templateEngine.setAdditionalDialects(dialects); |
91 | | - return templateEngine; |
92 | | - } |
93 | | - |
94 | | - @Bean |
95 | | - public ServletContextTemplateResolver templateResolver() { |
96 | | - ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(); |
97 | | - templateResolver.setPrefix("/WEB-INF"); |
98 | | - templateResolver.setTemplateMode("HTML5"); |
99 | | - return templateResolver; |
| 65 | + public AjaxUrlBasedViewResolver viewResolver() { |
| 66 | + AjaxUrlBasedViewResolver resolver = new AjaxUrlBasedViewResolver(); |
| 67 | + resolver.setViewClass(FlowAjaxTiles3View.class); |
| 68 | + return resolver; |
100 | 69 | } |
101 | 70 |
|
102 | 71 | @Bean |
103 | | - public ThymeleafTilesConfigurer tilesConfigurer() { |
104 | | - ThymeleafTilesConfigurer configurer = new ThymeleafTilesConfigurer(); |
| 72 | + public TilesConfigurer tilesConfigurer() { |
| 73 | + TilesConfigurer configurer = new TilesConfigurer(); |
105 | 74 | configurer.setDefinitions("/WEB-INF/**/views.xml"); |
106 | 75 | return configurer; |
107 | 76 | } |
|
0 commit comments