当我像这样在templateEngine中注册spring安全方言
<context:component-scan base-package="com.RJproject"/>
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<constructor-arg ref="servletContext"/>
<property name="prefix" value="/WEB-INF/templates/"/>
<property name="suffix" value=".html"/>
<property name="templateMode" value="HTML"/>
</bean>
<bean id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="additionalDialects">
<set>
<bean class="org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect"/>
</set>
</property>
<property name="templateResolver" ref="templateResolver"/>
</bean>
我收到一个错误,无法使用NoSuchMethodError加载带有方言的嵌套类。但如果没有方言,百里香'sec:isAuthenticated()'不起作用。
这是pom文件:
<properties>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
</properties>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>${thymeleaf.version}</version>
</dependency>