public class MyFreeMarkerConfigurer extends FreeMarkerConfigurer { @Override public void afterPropertiesSet() throws IOException, TemplateException { super.afterPropertiesSet(); Configuration cf = this.getConfiguration(); cf.setSharedVariable("shiro",new ShiroTags()); } }