Java 类org.springframework.web.servlet.view.velocity.VelocityConfig 实例源码

项目:quartz-glass    文件:SpringConfig.java   
@Bean
public VelocityConfig velocityConfig() throws IOException, VelocityException {
    Properties config = new Properties();
    config.setProperty("input.encoding", "UTF-8");
    config.setProperty("output.encoding", "UTF-8");
    config.setProperty("default.contentType", "text/html;charset=UTF-8");
    config.setProperty("resource.loader", "class");
    config.setProperty("class.resource.loader.class",
            "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");

    VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
    velocityConfigurer.setVelocityProperties(config);
    velocityConfigurer.afterPropertiesSet();

    return velocityConfigurer;
}
项目:ARCLib    文件:VelocityAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(VelocityConfig.class)
public VelocityConfigurer velocityConfigurer() {
    VelocityConfigurer configurer = new VelocityConfigurer();
    applyProperties(configurer);
    return configurer;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:VelocityAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(VelocityConfig.class)
public VelocityConfigurer velocityConfigurer() {
    VelocityConfigurer configurer = new VelocityConfigurer();
    applyProperties(configurer);
    return configurer;
}
项目:spring-boot-concourse    文件:VelocityAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(VelocityConfig.class)
public VelocityConfigurer velocityConfigurer() {
    VelocityConfigurer configurer = new VelocityConfigurer();
    applyProperties(configurer);
    return configurer;
}
项目:contestparser    文件:VelocityAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(VelocityConfig.class)
public VelocityConfigurer velocityConfigurer() {
    VelocityConfigurer configurer = new VelocityConfigurer();
    applyProperties(configurer);
    return configurer;
}
项目:orchidae    文件:WebMvcConfig.java   
@Bean
public VelocityConfig velocityConfig()
{
    Properties p = new Properties();
    p.put( "resource.loader", "webapp" );
    p.put( "webapp.resource.loader.path", new File( webapp, "html" ).toString() );
    p.put( "webapp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader" );
    VelocityConfigurer vc = new VelocityConfigurer();
    VelocityEngine engine = new VelocityEngine( p );
    engine.init();
    vc.setVelocityEngine( engine );
    return vc;
}
项目:sharding    文件:VelocityView.java   
/**
 * Autodetect a VelocityEngine via the ApplicationContext. Called if no
 * explicit VelocityEngine has been specified.
 * 
 * @return the VelocityEngine to use for VelocityViews
 * @throws BeansException
 *             if no VelocityEngine could be found
 * @see #getApplicationContext
 * @see #setVelocityEngine
 */
protected VelocityEngine autodetectVelocityEngine() throws BeansException {
    try {
        VelocityConfig velocityConfig = BeanFactoryUtils.beanOfTypeIncludingAncestors(getApplicationContext(),
                VelocityConfig.class, true, false);
        return velocityConfig.getVelocityEngine();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException(
                "Must define a single VelocityConfig bean in this web application context "
                        + "(may be inherited): VelocityConfigurer is the usual implementation. "
                        + "This bean may be given any name.", ex);
    }
}
项目:sharding    文件:VelocityTemplateModule.java   
/**
 * Autodetect a VelocityEngine via the ApplicationContext.
 * Called if no explicit VelocityEngine has been specified.
 * @return the VelocityEngine to use for VelocityViews
 * @throws BeansException if no VelocityEngine could be found
 * @see #getApplicationContext
 * @see #setVelocityEngine
 */
protected VelocityEngine autodetectVelocityEngine() throws BeansException {
    try {
        VelocityConfig velocityConfig = BeanFactoryUtils.beanOfTypeIncludingAncestors(getApplicationContext(),
                VelocityConfig.class, true, false);
        return velocityConfig.getVelocityEngine();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException(
                "Must define a single VelocityConfig bean in this web application context "
                        + "(may be inherited): VelocityConfigurer is the usual implementation. "
                        + "This bean may be given any name.", ex);
    }
}