我将按照Jespers的建议使用FreeMarker。
为了回答我的问题,如果某人无法切换技术但想转到Springboot 1.5.x,这里是一个简单的解决方案:需要更改属性,删除
spring.velocity.properties :
resource.loader=jarjar.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoaderjar.runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystemjar.runtime.log.logsystem.log4j.category=velocityjar.resource.loader.cache=trueinput.encoding=UTF-8
添加创建Bean的属性:
@BeanVelocityEngine velocityEngine(){ Properties properties = new Properties(); properties.load(this.getClass().getResourceAsStream("/application.properties")); return new VelocityEngine(properties);}一个重要的缺点是,使用该解决方案,您无法在不更改Velocity引擎的情况下更改属性文件名。因此,它消除了Springboot的某些灵活性。



