我已经在commit尝试了您的项目
3b9a6a2e,但错误实际上有所不同:
org.springframework.beans.factory.BeanCreationException:创建名称为’webSecurityConfig’的bean时出错:自动连接的依赖项注入失败;嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动装配字段:private
myapp.MyUserDetailsService myapp.WebSecurityConfig.userDetailsService;
嵌套的异常是java.lang.IllegalArgumentException:
无法将myapp.MyUserDetailsService字段myapp.WebSecurityConfig.userDetailsService设置为com.sun.proxy。$
Proxy80
这使您的问题成为Spring无法创建bean)的副本。解决方案:更换
@Autowiredprivate MyUserDetailsService userDetailsService;
与
@Autowiredprivate UserDetailsService userDetailsService;
您的解决方案(删除
@Transactional)之所以有效
@Transactional,是因为没有理由,Spring不需要包装
MyUserDetailsService代理。



