【问题标题】:Annotation based user retrieval Spring security基于注解的用户检索 Spring security
【发布时间】:2012-06-18 08:06:30
【问题描述】:

我正在寻找如何接收活动/登录用户的正确方法。我将 Spring Security 3.1 与相同版本的 Spring MVC 一起使用。 整个想法基于this topic,文章中有更多评论:

@ActiveUser annotation from the article

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

No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.security.core.userdetails.User.<init>()]

在我的applicationContext.xml中我有这三个注释不是由作者直接提出的

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

什么可能导致这种问题?

【问题讨论】:

    标签: spring-mvc spring-security spring-annotations


    【解决方案1】:

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

    这种问题在 Spring 3.1(我使用)中的解决方案与 Spring 3.0(提到的教程)中的解决方案不同。此处介绍了有关该问题的精彩文章:enter link description here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-08
      • 2016-10-14
      • 2020-12-18
      • 2015-04-09
      • 2015-06-25
      • 1970-01-01
      • 2011-07-21
      • 1970-01-01
      相关资源
      最近更新 更多