java beetl模板引擎_Spring Boot集成beetl模板引擎 个人总结

本文详细介绍了如何在Spring Boot项目中快速集成Beetl模板引擎,包括添加依赖、配置基础设置,以及自定义Java8日期时间类型的格式化支持。同时,展示了如何使用sputil提供的Spring相关函数,并指导了自定义方法的集成。
摘要由CSDN通过智能技术生成

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值