首页 > 学院 > 开发设计 > 正文

SpringBoot整合velocity

2019-11-06 06:17:18
字体:
来源:转载
供稿:网友

一、在pom.xml中添加velocity依赖

<dependency> <groupId>org.sPRingframework.boot</groupId> <artifactId>spring-boot-starter-velocity</artifactId> <version>1.4.1.RELEASE</version> </dependency>

二、在application.peroperties中添加valocity配置信息

spring.velocity.charset=UTF-8spring.velocity.properties.input.encoding=UTF-8spring.velocity.properties.output.encoding=UTF-8spring.velocity.resource-loader-path=/WEB-INF/views/spring.velocity.suffix=.htmlspring.velocity.toolbox-config-location=/WEB-INF/velocity/toolbox.xmlspring.velocity.properties.userdirective=com.xxx.velocity.directive.BlockDirective,com.xxx.velocity.directive.OverrideDirective,com.xxx.velocity.directive.ExtendsDirective

三、toolbox.xml

<?xml version="1.0" encoding="UTF-8"?><toolbox> <tool> <key>date</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.DateTool</class> </tool> <tool> <key>math</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.MathTool</class> </tool> <tool> <key>number</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.NumberTool</class> </tool> <tool> <key>render</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.RenderTool</class> </tool> <tool> <key>esc</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.EscapeTool</class> </tool> <tool> <key>alternator</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.AlternatorTool</class> </tool> <tool> <key>parser</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.ValueParser</class> </tool> <tool> <key>sorter</key> <scope>application</scope> <class>org.apache.velocity.tools.generic.SortTool</class> </tool> <!-- velocity 自定义标签 --> <!-- <tool> <key>shiro</key> <scope>application</scope> <class>com.base.shiro.VelocityShiro</class> </tool> --></toolbox>

未完待续。。。。。。


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表