This content has been marked as final.
Show 2 replies
-
1. Re: CDI + EL question
gavin.king Jan 20, 2010 5:22 PM (in response to pjiricka)@Named is not declared @Inherited, and even if it were, it would have no effect in this case, since @Inherited applies only to class inheritance and not to interface implementation.
And an interface is not a bean.
So you need to put the @Named (and also @RequestScoped) annotations on the bean, not on its interfaces.
-
2. Re: CDI + EL question
pjiricka Jan 21, 2010 4:41 PM (in response to pjiricka)Thanks for explaining, I see. Now I know how I can achieve what I wanted, the previous example should have been something like:
public interface Bean extends Serializable {
public String getName();
}
public class BeanImpl implements Bean, Serializable {
public String getName() { return "x"; }
public static @Produces @Named("bean") Bean instance() {
return new BeanImpl();
};
}
Then I can write #{bean.name} in EL.