1. Spring boot快速集成beetl模板引擎
查看官方文档:http://ibeetl.com/guide/#beetl
可参看官方文档 4.6. Spring Boot集成
增加beetl包依赖
com.ibeetl
beetl
2.7.13
最基础配置类编写
@Configuration
public class BeetlConf {
@Value("${beetl.RESOURCE.root:/btl}")
private String resourceRoot;
@Bean(name = "beetlConfig")
public BeetlGroupUtilConfiguration getBeetlGroupUtilConfiguration() {
BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration();
try {
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(
this.getClass().getClassLoader(), resourceRoot);
beetlGroupUtilConfiguration.setResourceLoader(resourceLoader);
return beetlGroupUtilConfiguration;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Bean(name = "beetlViewResolver")
public BeetlSpringViewResolver getBeetlSpringViewResolver(
@Qualifier("beetlConfig") BeetlGroupUtilConfiguration beetlGroupUtilConfiguration) {
BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver();
beetlSpringViewResolver.setPrefix("/");
beetlSpringViewResolver.setSuffix(".btl");
beetlSpringViewResolver.setContentType("text/html;charset=UTF-8");
beetlS