首页 > 解决方案 > Spring Webflow 和继承

问题描述

我在 Spring WebFlow 中遇到了一个问题。我有一个扩展类 B 的类 A。类 B 看起来像这样:

public class B{
    private Collection<Class<?>> hints = new ArrayList<>();
    public B(){}
    public B(Collection<Class<?>> hints){ this.hints=hints; }

    //getter and setter for hints
}

A 类是一个表单,有一些字符串/整数作为私有字段。A 类扩展了 B 类并实现了 Serializable。在执行 WebFlow 期间,它some sort of the map可能以可能的形式存储对象并重新生成 A 的实例。遗憾的是,它不会复制 B 类。在hintsB 类的每次重新生成之后都是空集合。你能解释一下为什么会这样吗?我应该怎么做才能让它发挥作用?

标签: javaspringserializationspring-webflow

解决方案


好的,我想我很快就把它贴出来了。在 B 类中实现Serializable就可以了。但为什么?Spring WebFlow实施有何不同Serializable


推荐阅读