当前位置: 首页>>代码示例>>Java>>正文


Java FreeMarkerConfig类代码示例

本文整理汇总了Java中org.springframework.web.servlet.view.freemarker.FreeMarkerConfig的典型用法代码示例。如果您正苦于以下问题:Java FreeMarkerConfig类的具体用法?Java FreeMarkerConfig怎么用?Java FreeMarkerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FreeMarkerConfig类属于org.springframework.web.servlet.view.freemarker包,在下文中一共展示了FreeMarkerConfig类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Bean
	@ConditionalOnMissingBean({FreeMarkerConfig.class, FreeMarkerViewResolver.class})
	public FreeMarkerConfigurer freeMarkerConfigurer() {
		PluginFreeMarkerConfigurer configurer = new PluginFreeMarkerConfigurer();
		applyProperties(configurer);
		String[] paths = this.properties.getTemplateLoaderPath();
//		paths = ArrayUtils.add(paths, WEBFTLS_PATH);
		configurer.setTemplateLoaderPaths(paths);
		
		List<WithAnnotationBeanData<FreeMarkerViewTools>> tools = SpringUtils.getBeansWithAnnotation(applicationContext, FreeMarkerViewTools.class);
		tools.forEach(t->{
			String name = t.getAnnotation().value();
			if(StringUtils.isBlank(name)){
				name = t.getBean().getClass().getSimpleName();
			}
			configurer.setFreemarkerVariable(name, t.getBean());
			logger.info("registered FreeMarkerViewTools : {}", name);
		});
		return configurer;
	}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:21,代码来源:WebFtlsContextConfig.java

示例2: getFreeMarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
public static FreeMarkerConfig getFreeMarkerConfig(ApplicationContext applicationContext, String templateLoaderPath) {
	if (configurer != null) {
		return configurer;
	}
	configurer = getFreeMarkerConfigurer(applicationContext, templateLoaderPath);
	return configurer;
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:8,代码来源:FreeMarkerUtil.java

示例3: contextInitialized

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
public void contextInitialized(ServletContextEvent sc) {
	logger.info("[5i net registry listener starting...]");
	
	ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(sc.getServletContext());
	
	// 资源实例
	ResourceBundle resource = ResourceBundle.getInstance();
	resource.setFreemarkerConfig((FreeMarkerConfig) context.getBean("freemarkerConfig"));
	
	logger.info("[5i net registry listener finished...]");
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:12,代码来源:RegistryListener.java

示例4: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(FreeMarkerConfig.class)
public FreeMarkerConfigurer freeMarkerConfigurer() {
	FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
	applyProperties(configurer);
	return configurer;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:FreeMarkerAutoConfiguration.java

示例5: autodetectConfiguration

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
/**
 * 自动检测FreeMarkerConfig
 * 
 * @return
 * @throws BeansException
 */
protected FreeMarkerConfig autodetectConfiguration() throws BeansException {
	try {
		return (FreeMarkerConfig) BeanFactoryUtils
				.beanOfTypeIncludingAncestors(getApplicationContext(),
						FreeMarkerConfig.class, true, false);
	} catch (NoSuchBeanDefinitionException ex) {
		throw new ApplicationContextException(
				"Must define a single FreeMarkerConfig bean in this web application context "
						+ "(may be inherited): FreeMarkerConfigurer is the usual implementation. "
						+ "This bean may be given any name.", ex);
	}
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:19,代码来源:SimpleFreeMarkerView.java

示例6: autodetectConfiguration

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Override
protected FreeMarkerConfig autodetectConfiguration() throws BeansException {
	try {

		return (FreeMarkerConfig) BeanFactoryUtils.beanOfType(
				getApplicationContext(), FreeMarkerConfig.class, true,
				false);
	} catch (NoSuchBeanDefinitionException ex) {
		throw new ApplicationContextException(
				"Must define a single FreeMarkerConfig bean in this web application context "
						+ "(may be inherited): FreeMarkerConfigurer is the usual implementation. "
						+ "This bean may be given any name.", ex);
	}
}
 
开发者ID:juweiping,项目名称:ocms,代码行数:15,代码来源:CmsFreeMarkerView.java

示例7: freemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Bean
public FreeMarkerConfigurer freemarkerConfig() throws IOException, TemplateException {
    FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
    freeMarkerConfigurer.setConfiguration(new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_22) {{
        setTemplateLoader(new MultiTemplateLoader(
                new TemplateLoader[]{
                        new ClassTemplateLoader(FreeMarkerConfig.class, "/")
                }
        ));
        setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
        setWhitespaceStripping(true);
    }});
    return freeMarkerConfigurer;
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:15,代码来源:WebMvcConfiguration.java

示例8: autodetectConfiguration

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Override
protected FreeMarkerConfig autodetectConfiguration() throws BeansException {
	System.out.println("autodetectConfiguration:");
	String templateLoaderPath = "";
	return FreeMarkerUtil.getFreeMarkerConfig(super.getApplicationContext(), templateLoaderPath);
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:7,代码来源:FtlView.java

示例9: getFreemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
public FreeMarkerConfig getFreemarkerConfig() {
	return freemarkerConfig;
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:4,代码来源:ResourceBundle.java

示例10: setFreemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
public void setFreemarkerConfig(FreeMarkerConfig freemarkerConfig) {
	this.freemarkerConfig = freemarkerConfig;
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:4,代码来源:ResourceBundle.java

示例11: freeMarkerConfiguration

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
@Bean
public freemarker.template.Configuration freeMarkerConfiguration(
		FreeMarkerConfig configurer) {
	return configurer.getConfiguration();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:FreeMarkerAutoConfiguration.java

示例12: initApplicationContext

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; //导入依赖的package包/类
/**
 * Invoked on startup. Looks for a single FreeMarkerConfig bean to find the
 * relevant Configuration for this factory.
 * <p>
 * Checks that the template for the default Locale can be found: FreeMarker
 * will check non-Locale-specific templates if a locale-specific one is not
 * found.
 * 
 * @see freemarker.cache.TemplateCache#getTemplate
 */
protected void initApplicationContext() throws BeansException {
	super.initApplicationContext();

	if (getConfiguration() == null) {
		FreeMarkerConfig config = autodetectConfiguration();
		setConfiguration(config.getConfiguration());
	}
	checkTemplate();
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:20,代码来源:SimpleFreeMarkerView.java


注:本文中的org.springframework.web.servlet.view.freemarker.FreeMarkerConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。