All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rythmengine.spring.RythmEngineFactoryBean Maven / Gradle / Ivy

package org.rythmengine.spring;

import org.rythmengine.RythmEngine;
import org.rythmengine.exception.RythmException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ResourceLoaderAware;

import java.io.IOException;

/**
 * Factory bean that configures a RythmEngine and provides it as bean
 * reference. This bean is intended for any kind of usage of Rythm in
 * application code, e.g. for generating email content. For web views,
 * RythmConfigurer is used to set up a RythmEngine for views.
 *
 * 

The simplest way to use this class is to specify a "resourceLoaderPath"; * you do not need any further configuration then. For example, in a web * application context: * *

 <bean id="RythmEngine" class="org.rythmengine.spring.RythmEngineFactoryBean">
 *   <property name="resourceLoaderPath" value="/WEB-INF/rythm/"/>
 * </bean>
* * See the base class RythmEngineFactory for configuration details. * * @author Gelin Luo * @see #setConfigLocation * @see #setEngineConfig * @see #setResourceLoaderPath * @see org.rythmengine.spring.web.RythmConfigurer */ public class RythmEngineFactoryBean extends RythmEngineFactory implements FactoryBean, InitializingBean, ResourceLoaderAware { private RythmEngine engine; public void afterPropertiesSet() throws IOException, RythmException { this.engine = createRythmEngine(); } public RythmEngine getObject() { return this.engine; } public Class getObjectType() { return RythmEngine.class; } public boolean isSingleton() { return true; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy