|
1 | 1 | package pl.allegro.tech.boot.autoconfigure.handlebars;
|
2 | 2 |
|
3 |
| -import com.github.jknack.handlebars.HumanizeHelper; |
4 |
| -import com.github.jknack.handlebars.Jackson2Helper; |
5 |
| -import com.github.jknack.handlebars.helper.AssignHelper; |
6 |
| -import com.github.jknack.handlebars.helper.IncludeHelper; |
7 |
| -import com.github.jknack.handlebars.helper.JodaHelper; |
8 |
| -import com.github.jknack.handlebars.helper.NumberHelper; |
| 3 | +import com.github.jknack.handlebars.helper.ext.AssignHelper; |
| 4 | +import com.github.jknack.handlebars.helper.ext.IncludeHelper; |
| 5 | +import com.github.jknack.handlebars.helper.ext.JodaHelper; |
| 6 | +import com.github.jknack.handlebars.helper.ext.NumberHelper; |
9 | 7 | import com.github.jknack.handlebars.helper.StringHelpers;
|
| 8 | +import com.github.jknack.handlebars.jackson.JacksonHelper; |
10 | 9 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver;
|
11 | 10 | import org.joda.time.format.DateTimeFormat;
|
12 | 11 | import org.springframework.beans.BeansException;
|
13 | 12 | import org.springframework.beans.factory.annotation.Autowired;
|
14 | 13 | import org.springframework.beans.factory.config.BeanPostProcessor;
|
| 14 | +import org.springframework.boot.autoconfigure.AutoConfiguration; |
15 | 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
16 | 16 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
17 | 17 | import org.springframework.context.annotation.Bean;
|
18 | 18 | import org.springframework.context.annotation.Configuration;
|
19 | 19 |
|
20 |
| -import javax.annotation.PostConstruct; |
| 20 | +import jakarta.annotation.PostConstruct; |
21 | 21 |
|
22 | 22 | import static org.springframework.core.annotation.AnnotationUtils.findAnnotation;
|
23 | 23 |
|
24 |
| -@Configuration |
| 24 | +@AutoConfiguration |
25 | 25 | @ConditionalOnClass(HandlebarsViewResolver.class)
|
26 | 26 | @ConditionalOnWebApplication
|
27 | 27 | public class HandlebarsHelpersAutoConfiguration {
|
28 | 28 |
|
29 | 29 | @Configuration
|
30 |
| - @ConditionalOnClass(Jackson2Helper.class) |
| 30 | + @ConditionalOnClass(JacksonHelper.class) |
31 | 31 | static class JsonHelperAutoConfiguration {
|
32 | 32 |
|
33 | 33 | @Autowired
|
34 | 34 | private HandlebarsViewResolver handlebarsViewResolver;
|
35 | 35 |
|
36 | 36 | @PostConstruct
|
37 | 37 | public void registerHelper() {
|
38 |
| - handlebarsViewResolver.registerHelper("json", Jackson2Helper.INSTANCE); |
| 38 | + handlebarsViewResolver.registerHelper("json", JacksonHelper.INSTANCE); |
39 | 39 | }
|
40 | 40 | }
|
41 | 41 |
|
@@ -78,19 +78,6 @@ public void registerHelpers() {
|
78 | 78 | }
|
79 | 79 | }
|
80 | 80 |
|
81 |
| - @Configuration |
82 |
| - @ConditionalOnClass(HumanizeHelper.class) |
83 |
| - static class HumanizeHelpersAutoConfiguration { |
84 |
| - |
85 |
| - @Autowired |
86 |
| - private HandlebarsViewResolver handlebarsViewResolver; |
87 |
| - |
88 |
| - @PostConstruct |
89 |
| - public void registerHelpers() { |
90 |
| - HumanizeHelper.register(handlebarsViewResolver.getHandlebars()); |
91 |
| - } |
92 |
| - } |
93 |
| - |
94 | 81 | @Configuration
|
95 | 82 | @ConditionalOnClass({JodaHelper.class, DateTimeFormat.class})
|
96 | 83 | static class JodaHelpersAutoConfiguration {
|
|
0 commit comments