1 16 17 package org.springframework.ui.velocity; 18 19 import java.io.IOException ; 20 21 import org.apache.velocity.app.VelocityEngine; 22 import org.apache.velocity.exception.VelocityException; 23 24 import org.springframework.beans.factory.FactoryBean; 25 import org.springframework.beans.factory.InitializingBean; 26 import org.springframework.context.ResourceLoaderAware; 27 28 50 public class VelocityEngineFactoryBean extends VelocityEngineFactory 51 implements FactoryBean, InitializingBean, ResourceLoaderAware { 52 53 private VelocityEngine velocityEngine; 54 55 56 public void afterPropertiesSet() throws IOException , VelocityException { 57 this.velocityEngine = createVelocityEngine(); 58 } 59 60 61 public Object getObject() { 62 return this.velocityEngine; 63 } 64 65 public Class getObjectType() { 66 return VelocityEngine.class; 67 } 68 69 public boolean isSingleton() { 70 return true; 71 } 72 73 } 74 | Popular Tags |