在将我的应用程序与Thymeleaf&Spring Security演示应用程序进行了紧密比较之后,我发现了错误的根源。
显然,为了让Thymeleaf处理
sec:authorize和
sec:authentication属性,您需要注册
SpringSecurityDialect为模板引擎bean的其他方言。
<bean id="templateEngine" > <property name="templateResolver" ref="templateResolver" /> <property name="additionalDialects"> <set> <bean /> </set> </property></bean>
令人惊讶的是,在相关的Thymeleaf文档页面上没有提及该事实。我希望这对将来会遇到相同问题的其他人有所帮助。



