Java Code Examples for org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean

Following code examples demonstrate how to use org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBeanfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBeanand various code implementation of this class.

    public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration() {
        FreeMarkerConfigurationFactoryBean bean = new FreeMarkerConfigurationFactoryBean();
        bean.setTemplateLoaderPath("classpath:/templates/");
        return bean;
    } 


	public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration() {
		FreeMarkerConfigurationFactoryBean freeMarkerConfigFactoryBean = new FreeMarkerConfigurationFactoryBean();

		freeMarkerConfigFactoryBean.setTemplateLoaderPath("/templates/");

		return freeMarkerConfigFactoryBean;
	} 

	public FreeMarkerConfigurationFactoryBean freemarkerMailConfig() {
		FreeMarkerConfigurationFactoryBean freeMarkerConfigurationFactoryBean = new FreeMarkerConfigurationFactoryBean();
		freeMarkerConfigurationFactoryBean.setTemplateLoaderPath("classpath:/com/sharpinu/email/templates");
		freeMarkerConfigurationFactoryBean.setPreferFileSystemAccess(false);
		return freeMarkerConfigurationFactoryBean;
	} 

    public FreeMarkerConfigurationFactoryBean freeMarkerConfigurationFactoryBean() {
        FreeMarkerConfigurationFactoryBean bean = new FreeMarkerConfigurationFactoryBean();
        bean.setTemplateLoaderPath("/templates/");
        return bean;
    } 

    public FreeMarkerConfigurationFactoryBean getFreemarkerConfiguration() {
        FreeMarkerConfigurationFactoryBean factoryBean = new FreeMarkerConfigurationFactoryBean();
        factoryBean.setTemplateLoaderPath("classpath:/reports/");

        return factoryBean;
    } 

    public FreeMarkerConfigurationFactoryBean freemarkerConfiguration() {
        FreeMarkerConfigurationFactoryBean o = new FreeMarkerConfigurationFactoryBean();
        o.setTemplateLoaderPath("classpath:META-INF/templates/");
        return o;
    } 

	public FreeMarkerConfigurationFactoryBean factoryBean() {
		FreeMarkerConfigurationFactoryBean bean=new FreeMarkerConfigurationFactoryBean();
		bean.setTemplateLoaderPath("classpath:/templates");
		return bean;
	} 

	public FreeMarkerConfigurationFactoryBean  factoryBean() {
		
		FreeMarkerConfigurationFactoryBean bean = new FreeMarkerConfigurationFactoryBean();
		bean.setTemplateLoaderPath("classpath:/templates");
		return bean;
	} 

Advertisement
Javadoc
Factory bean that creates a FreeMarker Configuration and provides it as bean reference. This bean is

intended for any kind of usage of FreeMarker in application code, e.g. for generating email content. For web views, FreeMarkerConfigurer is used to set up a FreeMarkerConfigurationFactory. The simplest way to use this class is to specify just a "templateLoaderPath"; you do not need any further configuration then. For example, in a web application context: <bean id="freemarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean"> <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/> </bean> See the base class FreeMarkerConfigurationFactory for configuration details.

Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher. @author Darren Davison @since 03.03.2004 @see #setConfigLocation @see #setFreemarkerSettings @see #setTemplateLoaderPath @see org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer

Read More
Advertisement