Spring mvc 基于注释的用户检索Spring安全

Spring mvc 基于注释的用户检索Spring安全,spring-mvc,spring-security,spring-annotations,Spring Mvc,Spring Security,Spring Annotations,我在寻找如何接收活动/登录用户的正确方法。我将SpringSecurity3.1与SpringMVC的相同版本一起使用。 整个想法基于文章中更多的评论: 我完全按照说明进行操作,但仍然会出现这种错误: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.security.core.userdetails.User.<init>()

我在寻找如何接收活动/登录用户的正确方法。我将SpringSecurity3.1与SpringMVC的相同版本一起使用。 整个想法基于文章中更多的评论:

我完全按照说明进行操作,但仍然会出现这种错误:

No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.security.core.userdetails.User.<init>()]
未找到默认构造函数;嵌套异常是java.lang.NoSuchMethodException:org.springframework.security.core.userdetails.User.()
在applicationContext.xml中,我有三个注释,它们不是由本文作者直接提出的

<context:annotation-config />
<context:component-scan base-package="my.package.*" />
<mvc:annotation-driven />


什么会导致这种问题?

在互联网上搜索了几个小时后,我发现我应该如何解决这个问题。因为它可能对其他人有用,所以我提供了解决方案

这种问题在Spring3.1(我使用的)中的解决方案与Spring3.0(前面提到的教程是针对Spring3.0的)中的解决方案不同。关于这个问题的精彩文章出现在这里: