package com.jiayue.ipp.idp; import org.apache.velocity.app.Velocity; import org.apache.velocity.app.VelocityEngine; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import java.util.Properties; @SpringBootApplication public class IppIdpApplication { public static void main(String[] args) { SpringApplication.run(IppIdpApplication.class, args); } /** * 上报文件模板引擎 * * @return 返回模板引擎 */ @Bean public VelocityEngine velocityEngine() { VelocityEngine ve = new VelocityEngine(); Properties properties = new Properties(); //设置velocity资源加载方式为file properties.setProperty("resource.loader", "file"); //设置velocity资源加载方式为file时的处理类 properties .setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); properties.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, ""); properties.setProperty(Velocity.ENCODING_DEFAULT, "UTF-8"); properties.setProperty(Velocity.INPUT_ENCODING, "UTF-8"); properties.setProperty(Velocity.OUTPUT_ENCODING, "UTF-8"); ve.init(properties); return ve; } @Bean public TaskScheduler taskScheduler(){ ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); // 线程池大小 taskScheduler.setPoolSize(100); // 线程名字的前缀 taskScheduler.setThreadNamePrefix("taskScheduler"); return taskScheduler; } }