spring boot freemarker全局属性
在spring boot中配置freemarker的全局属性
1 2 3 4 5 6 7 8 9 10 11 12
| @Configuration public class FreemarkerConfiguration extends FreeMarkerAutoConfiguration.FreeMarkerWebConfiguration {
@Override public FreeMarkerConfigurer freeMarkerConfigurer() { FreeMarkerConfigurer configurer = super.freeMarkerConfigurer(); Map<String, Object> sharedVariables = new HashMap<>(); sharedVariables.put("BASE_URL", "/admin"); configurer.setFreemarkerVariables(sharedVariables); return configurer; } }
|