SpringBoot集成velocity
2016-08-27 00:00
330 查看
摘要: SpringBoot集成velocity
pom.xml
application.properties
toolbox.xml
页面调用方式:
<td>$!velocityTool.getFormatTime($dateTime)</td>
pom.xml
<!-- thymeleaf是spring的默认主题 --> <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> --> <!-- 默认配置下spring boot会从src/main/resources/templates目录中去找模板 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-velocity</artifactId> </dependency>
application.properties
# VELOCITY TEMPLATES (VelocityAutoConfiguration) spring.velocity.resourceLoaderPath=classpath:/templates/ #spring.velocity.suffix=.html spring.velocity.suffix=.vm spring.velocity.toolbox-config-location=toolbox.xml spring.velocity.charset=UTF-8 spring.velocity.properties.input.encoding=UTF-8 spring.velocity.properties.output.encoding=UTF-8
toolbox.xml
<?xml version="1.0"?> <toolbox> <tool> <key>velocityTool</key> <scope>application</scope> <class>cn.no7player.util.VelocityTool</class> </tool> </toolbox>
页面调用方式:
<td>$!velocityTool.getFormatTime($dateTime)</td>
相关文章推荐
- spring aop 无法代理父类方法 的解决方法
- Spring MVC过滤器-超类 GenericFilterBean
- 一个jar包里的网站
- 一个jar包里的网站之文件上传
- 一个jar包里的网站之返回对媒体类型
- Spring和ThreadLocal
- Spring Boot 开发微服务
- Spring AOP动态代理-切面
- Spring整合Quartz(JobDetailBean方式)
- Spring整合Quartz(JobDetailBean方式)
- 电脑硬件分析Ultimate Boot CD v4.1.1 下载
- 模拟Spring的简单实现
- Spring整合WebSocket应用示例(上)
- spring+html5实现安全传输随机数字密码键盘
- Spring中属性注入详解