2015-09-24 102 views
1

我们刚刚将以前的版本从spring 3.x更新到Spring 4.x.我已经改变了我AnonymousAuthenticationFilter豆从这个必须设置匿名身份验证主体。 Spring 4.x

<bean id="anonymousAuthenticationFilter" class="org.springframework.security.web.authentication.AnonymousAuthenticationFilter"> 
<property name="key" value="foobar"/> 
<property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/> 

这个

<bean id ="anonymousAuthFilter" class="org.springframework.security.web.authentication.AnonymousAuthenticationFilter"> 
<constructor-arg value="key"/> 
<constructor-arg value="#{userAttribute.password}"/> 
<constructor-arg value="#{userAttribute.authorities}"/> 

但现在我们得到一个编译错误读取 构造抛出异常:nexted异常是java.l ang.IllegalArgumentException:必须设置匿名身份验证主体。

任何帮助将是伟大的。谢谢

回答

0

这是因为您所引入的新变量(密码和角色)未设置。你有这个错误是因为这种表达决心空

<constructor-arg value="#{userAttribute.password}"/> 
<constructor-arg value="#{userAttribute.authorities}"/> 

定义必要的变量,并根据您的原始userAttribute对象上已更换,它会工作。

相关问题