org.springframework.ui.velocity.VelocityEngineFactory Java Examples

The following examples show how to use org.springframework.ui.velocity.VelocityEngineFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VelocityAutoConfiguration.java    From velocity-spring-boot-project with Apache License 2.0 5 votes vote down vote up
protected void applyProperties(VelocityEngineFactory factory) {
    factory.setResourceLoaderPath(this.properties.getResourceLoaderPath());
    factory.setPreferFileSystemAccess(this.properties.isPreferFileSystemAccess());
    Properties velocityProperties = new Properties();
    velocityProperties.setProperty("input.encoding",
            this.properties.getCharsetName());
    velocityProperties.putAll(this.properties.getProperties());
    factory.setVelocityProperties(velocityProperties);
}
 
Example #2
Source File: MailAppConfig.java    From logsniffer with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public VelocityEngine velocityEngine() throws VelocityException,
		IOException {
	VelocityEngineFactory factory = new VelocityEngineFactory();
	Properties props = new Properties();
	props.put("resource.loader", "class");
	props.put("class.resource.loader.class",
			"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
	factory.setVelocityProperties(props);
	return factory.createVelocityEngine();
}