The <managed-bean>
entry in faces-config.xml
basically declares a new @ManagedBean
. I.e. a JSF managed bean. However, with @Inject
you're basically injecting a CDI managed bean.
Those are two mutually exclusive ways of managing beans. Effectively, you end up with 2 instances of the very same bean class, one managed by JSF via faces-config.xml
and another one managed by CDI via annotations. Only the one managed by JSF has those properties set.
You've 2 options:
Use
@ManagedProperty
to inject it as a JSF managed bean. This in turn however requires that the acceptor is by itself also a JSF managed bean.Forget the
faces-config.xml
approach altogether. Define them as JNDI resources in eitherweb.xml
or server config and use@Resource
to inject them. Alternatively, define them as.properties
file settings or<context-param>
entries inweb.xml
. CDI doesn't offer ways out the box to inject them, but it's possible to create a custom annotation with a CDIProducer
for that.