|
| 1 | +// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO. |
| 2 | +// You may push code into the target .java compilation unit if you wish to edit any member(s). |
| 3 | + |
| 4 | +package com.baeldung.config; |
| 5 | + |
| 6 | +import com.baeldung.config.WebMvcConfiguration; |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; |
| 8 | +import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties; |
| 9 | +import org.springframework.context.ApplicationContext; |
| 10 | +import org.springframework.context.ApplicationContextAware; |
| 11 | +import org.springframework.context.annotation.Bean; |
| 12 | +import org.thymeleaf.TemplateEngine; |
| 13 | +import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; |
| 14 | +import org.thymeleaf.spring4.view.ThymeleafViewResolver; |
| 15 | +import org.thymeleaf.templatemode.TemplateMode; |
| 16 | + |
| 17 | +privileged aspect WebMvcConfiguration_Roo_ThymeleafUIConfiguration { |
| 18 | + |
| 19 | + declare parents: WebMvcConfiguration implements ApplicationContextAware; |
| 20 | + |
| 21 | + /** |
| 22 | + * TODO Auto-generated attribute documentation |
| 23 | + * |
| 24 | + */ |
| 25 | + @Autowired |
| 26 | + private ThymeleafProperties WebMvcConfiguration.thymeleafProperties; |
| 27 | + |
| 28 | + /** |
| 29 | + * TODO Auto-generated attribute documentation |
| 30 | + * |
| 31 | + */ |
| 32 | + @Autowired |
| 33 | + private TemplateEngine WebMvcConfiguration.templateEngine; |
| 34 | + |
| 35 | + /** |
| 36 | + * TODO Auto-generated attribute documentation |
| 37 | + * |
| 38 | + */ |
| 39 | + private ApplicationContext WebMvcConfiguration.applicationContext; |
| 40 | + |
| 41 | + /** |
| 42 | + * TODO Auto-generated method documentation |
| 43 | + * |
| 44 | + * @return ThymeleafProperties |
| 45 | + */ |
| 46 | + public ThymeleafProperties WebMvcConfiguration.getThymeleafProperties() { |
| 47 | + return thymeleafProperties; |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * TODO Auto-generated method documentation |
| 52 | + * |
| 53 | + * @return TemplateEngine |
| 54 | + */ |
| 55 | + public TemplateEngine WebMvcConfiguration.getTemplateEngine() { |
| 56 | + return templateEngine; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * TODO Auto-generated method documentation |
| 61 | + * |
| 62 | + * @return ApplicationContext |
| 63 | + */ |
| 64 | + public ApplicationContext WebMvcConfiguration.getApplicationContext() { |
| 65 | + return applicationContext; |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * TODO Auto-generated method documentation |
| 70 | + * |
| 71 | + * @param applicationContext |
| 72 | + */ |
| 73 | + public void WebMvcConfiguration.setApplicationContext(ApplicationContext applicationContext) { |
| 74 | + this.applicationContext = applicationContext; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * TODO Auto-generated method documentation |
| 79 | + * |
| 80 | + * @return ThymeleafViewResolver |
| 81 | + */ |
| 82 | + @Bean |
| 83 | + public ThymeleafViewResolver WebMvcConfiguration.javascriptThymeleafViewResolver() { |
| 84 | + ThymeleafViewResolver resolver = new ThymeleafViewResolver(); |
| 85 | + resolver.setTemplateEngine(getTemplateEngine()); |
| 86 | + resolver.setCharacterEncoding("UTF-8"); |
| 87 | + resolver.setContentType("application/javascript"); |
| 88 | + resolver.setViewNames(new String[] {"*.js"}); |
| 89 | + resolver.setCache(getThymeleafProperties().isCache()); |
| 90 | + return resolver; |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * TODO Auto-generated method documentation |
| 95 | + * |
| 96 | + * @return SpringResourceTemplateResolver |
| 97 | + */ |
| 98 | + @Bean |
| 99 | + public SpringResourceTemplateResolver WebMvcConfiguration.javascriptTemplateResolver() { |
| 100 | + SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver(); |
| 101 | + resolver.setApplicationContext(getApplicationContext()); |
| 102 | + resolver.setPrefix("classpath:/templates/fragments/js/"); |
| 103 | + resolver.setTemplateMode(TemplateMode.JAVASCRIPT); |
| 104 | + resolver.setCharacterEncoding("UTF-8"); |
| 105 | + resolver.setCheckExistence(true); |
| 106 | + resolver.setCacheable(getThymeleafProperties().isCache()); |
| 107 | + return resolver; |
| 108 | + } |
| 109 | + |
| 110 | +} |
0 commit comments