通过spring的Environment获取配置文件的属性
解决方法:
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
ApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
Environment env =ac.getBean(Environment.class);
String tplpath = env.getProperty("spring.freemarker.template-loader-path");
Environment会加载application.properties和application-$(profile).properties文件的属性