如何自定义Seam 3凭证?

发布于 2024-11-25 06:24:51 字数 504 浏览 1 评论 0原文

有没有办法自定义seam 3凭证对象?

我需要向凭据(验证码)添加一项属性。我尝试了以下代码:

@Named("credentials") @SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}

但它与 org.jboss.seam.security.CredentialsImpl @Named 注释有冲突。我如何覆盖凭据?

is there any way to customize seam 3 credentials object?

I need to add one more attribute to credentials (captcha). I tryed the following code:

@Named("credentials") @SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}

But it has a conflict with org.jboss.seam.security.CredentialsImpl @Named annotation. How can i override the credentials?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您可以尝试CDI 专业化。 IE :

@Alternative 
@Specializes 
@SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}

Yould could try a CDI specialization. Ie :

@Alternative 
@Specializes 
@SessionScoped
public class Credentials extends CredentialsImpl {

    private static final long serialVersionUID = -4377742708407292709L;

    private String captcha;

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
         this.captcha = captcha;
    }

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文