Commit f371da35 authored by Matija Obreza's avatar Matija Obreza

VelocityEngine#afterPropertiesSet

parent 39cbc4ac
......@@ -16,9 +16,11 @@
package org.genesys2.spring.config;
import java.io.IOException;
import java.util.Properties;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.VelocityException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -64,10 +66,15 @@ public class SpringMailConfig {
}
@Bean
public VelocityEngine velocityEngine() {
public VelocityEngine velocityEngine() throws VelocityException, IOException {
final VelocityEngineFactoryBean velocityEngineFactoryBean = new VelocityEngineFactoryBean();
velocityEngineFactoryBean.setVelocityProperties(velocityProperties());
return velocityEngineFactoryBean.getObject();
velocityEngineFactoryBean.afterPropertiesSet();
VelocityEngine engine = velocityEngineFactoryBean.getObject();
if (engine == null) {
throw new RuntimeException("Velocity engine could not be created");
}
return engine;
}
private Properties javaMailProperties() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment