예제 #1
0
 @Bean
 public VelocityConfig velocityConfig() {
   Map<String, Object> velocityProperties = new HashMap<>();
   velocityProperties.put("eventhandler.include.class", IncludeRelativePath.class.getName());
   velocityProperties.put("input.encoding", "utf-8");
   velocityProperties.put("output.encoding", "utf-8");
   VelocityConfigurer cfg = new VelocityConfigurer();
   cfg.setResourceLoaderPath("/WEB-INF/views/");
   cfg.setVelocityPropertiesMap(velocityProperties);
   return cfg;
 }
 @Override
 protected void postProcessVelocityEngine(VelocityEngine velocityEngine) {
   super.postProcessVelocityEngine(velocityEngine);
   velocityEngine.setProperty(
       ROSE_MACRO_RESOURCE_LOADER_CLASS, ClasspathResourceLoader.class.getName());
   velocityEngine.addProperty(VelocityEngine.RESOURCE_LOADER, ROSE_MACRO_RESOURCE_LOADER_NAME);
   velocityEngine.addProperty(VelocityEngine.VM_LIBRARY, ROSE_MACRO_LIBRARY);
   if (logger.isInfoEnabled()) {
     logger.info(
         "ClasspathResourceLoader with name '"
             + ROSE_MACRO_RESOURCE_LOADER_NAME
             + "' added to configured VelocityEngine");
   }
 }
예제 #3
0
 @Bean
 public VelocityConfigurer velocityConfig() throws IOException {
   VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
   velocityConfigurer.setResourceLoaderPath("/WEB-INF/velocity/");
   return velocityConfigurer;
 }
 @Bean
 public VelocityEngine velocityEngine(VelocityConfigurer configurer)
     throws VelocityException, IOException {
   return configurer.getVelocityEngine();
 }