thymeleaf template change complate
parent
43ad473107
commit
a8ddf60848
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,68 @@
|
|||||||
|
package com.icomsys.main_vm.common.config;
|
||||||
|
|
||||||
|
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.ViewResolver;
|
||||||
|
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
|
||||||
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||||
|
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
|
||||||
|
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ConfigThymeleafViewResolver {
|
||||||
|
|
||||||
|
@Value("${spring.thymeleaf.cache}")
|
||||||
|
private boolean isCache;
|
||||||
|
@Value("${spring.thymeleaf.template-resolver-order}")
|
||||||
|
private int order;
|
||||||
|
@Value("${spring.thymeleaf.mode}")
|
||||||
|
private String mode;
|
||||||
|
|
||||||
|
//
|
||||||
|
@Bean
|
||||||
|
public SpringResourceTemplateResolver templateResolver() {
|
||||||
|
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
|
||||||
|
// templateResolver.setPrefix("classpath:webapp/WEB-INF/templates/");
|
||||||
|
templateResolver.setPrefix("classpath:templates");
|
||||||
|
templateResolver.setCharacterEncoding("UTF-8");
|
||||||
|
templateResolver.setSuffix(".html");
|
||||||
|
templateResolver.setTemplateMode(mode);
|
||||||
|
templateResolver.setCacheable(isCache);
|
||||||
|
templateResolver.setOrder(order);
|
||||||
|
return templateResolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SpringTemplateEngine templateEngine(MessageSource messageSource) {
|
||||||
|
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
|
||||||
|
templateEngine.setTemplateResolver(templateResolver());
|
||||||
|
templateEngine.setTemplateEngineMessageSource(messageSource);
|
||||||
|
templateEngine.addDialect(layoutDialect());
|
||||||
|
templateEngine.addDialect(new Java8TimeDialect());
|
||||||
|
|
||||||
|
return templateEngine;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LayoutDialect layoutDialect() {
|
||||||
|
return new LayoutDialect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ViewResolver viewResolver(MessageSource messageSource) {
|
||||||
|
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
|
||||||
|
viewResolver.setTemplateEngine(templateEngine(messageSource));
|
||||||
|
viewResolver.setCharacterEncoding("UTF-8");
|
||||||
|
viewResolver.setOrder(order);
|
||||||
|
return viewResolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Java8TimeDialect java8TimeDialect() {
|
||||||
|
return new Java8TimeDialect();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 429 B |
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 298 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue