本文介绍了WELD-000072声明钝化作用域的托管bean必须具有钝化能力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Java Web窗体编写了一个简单的程序,但收到以下错误:

I wrote a simple program in java web forms but i am receiving the following error:

有人可以告诉我在哪里此错误来自何处?

Can anyone tell me where this error comes from?

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;


@Named("DemoBeans")
@SessionScoped
public class DemoBeans {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}


推荐答案

您可以通过实现Serializable接口使您的bean钝化:

You can make your bean passivation capable by implementing the Serializable interface:

public class DemoBean implements Serializable { ... }

请注意,具有钝化能力还有更多要求。有关更多信息,请参阅焊接文档。

Note that there are more requirements for being passivation capable. Refer to the Weld documentation for more information.

这篇关于WELD-000072声明钝化作用域的托管bean必须具有钝化能力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:24