【问题标题】:Spring Web Flow 2.4.1 and Spring Security 4.0.1Spring Web Flow 2.4.1 和 Spring Security 4.0.1
【发布时间】:2015-07-18 16:02:58
【问题描述】:

我们在项目中使用了 Spring Web Flow 2.4.1 和 Spring Security 3.x(最高 3.2.6)。然而,在我们升级到 Spring Security 4.0.1 之后,我们得到了以下异常。有什么帮助吗?

java.lang.NoSuchMethodError: org.springframework.security.access.vote.AffirmativeBased: method <init>()V not found
at org.springframework.webflow.security.SecurityFlowExecutionListener.decide(SecurityFlowExecutionListener.java:102)

【问题讨论】:

    标签: spring-security spring-webflow


    【解决方案1】:

    ****** 更新答案 *******

    SWF 2.4.2 现已推出 spring.io/blog/2015/09/01/spring-web-flow-2-4-2-released

    将解决此问题。

    –尼尔·麦奎根

    ****** 老答案 *******

    发给:import org.springframework.security.access.vote.AffirmativeBased

    AffirmativeBased() 已弃用。 使用获取选民名单的构造函数

    http://docs.spring.io/autorepo/docs/spring-security/3.2.3.RELEASE/apidocs/org/springframework/security/access/vote/AffirmativeBased.html

    http://docs.spring.io/autorepo/docs/spring-security/4.0.1.RELEASE/apidocs/org/springframework/security/access/vote/AffirmativeBased.html

    在较新的 Spring Security 4.0.1 中删除了 AffirmativeBased() 空构造函数(在 3.2.6 中它已被标记为已弃用)

    org.springframework.webflow.security.SecurityFlowExecutionListener.decide(SecurityFlowExecutionListener.java:102)
    

    SecurityFlowExectionListener#decide 方法在第 102 行调用这个空构造函数。

    简答: Spring Webflow 2.4.1 未更新,Spring Security 4.0.1 恢复为 3.2.6

    长(短)答案:如果您无法恢复并希望继续使用 webflow... 这可能是一个长镜头尝试扩展 org.springframework.webflow.security.SecurityFlowExecutionListener 和 @Override决定方法。复制粘贴决定方法的原始代码,但从

    更改第 102 行
                abstractAccessDecisionManager = new AffirmativeBased();
    

                abstractAccessDecisionManager = new AffirmativeBased(voters);
    

    虽然这可能会解决您当前的问题...我怀疑这会揭示更多的不兼容问题,但我认为更改已经足够微不足道,值得一试。

    【讨论】:

    • 谢谢你,Airduster。是否有更新 Spring Web Flow 的计划?由于它与 Spring Security 集成,因此它可能是一个好主意。否则人们无法升级到新版本。
    • 我继承了 SecurityFlowExecutionListener 覆盖了决定方法,一切正常。
    • @Sergey 很高兴听到,如果可能的话,尝试为这个“错误”创建一个拉取请求。我不确定该项目在 github 上的发展势头很弱,但许多人仍在使用它,我怀疑他们最终将它只是一个低优先级,但在我们看到确认之前不要开始在新项目中使用 webflow。
    • @Sergey jira.spring.io/browse/SWF-1657 看起来已经有一个错误提交了
    猜你喜欢
    • 2013-01-13
    • 1970-01-01
    • 2015-09-01
    • 2015-07-12
    • 2017-05-29
    • 2012-03-20
    • 1970-01-01
    • 2015-11-10
    • 1970-01-01
    相关资源
    最近更新 更多