Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘myUserDetailsService’ is expected to be of type ‘cn.edu.sjzc.zc.mvc.config.MyUserDetailsService’ but was actually of type ‘com.sun.proxy.$Proxy31’
原因是使用@Autowired注入的userDetailsService对象是代理对象
使用下面的配置解决
@Bean
public UserDetailsService getUserDetailsService()
{
return new MyUserDetailsService();
}