我有一个调用某个bean的ServletContextListener
实现。我试图将会话bean注入该bean,但注入的会话bean始终为null
。
在BeanManager
执行期间,ServletContextListener
是否尚未启动? CDI和听众是否有已知的限制?或者我在代码中遗漏了什么?
以下是我尝试注入的SessionBean的定义 -
@Stateless
@Local(MetricStubSessionLocal.class)
@Remote(MetricStubSessionRemote.class)
public class MetricStubSessionBean implements MetricStubSessionLocal,
MetricStubSessionRemote {
...
}
以下是我试图注入的Bean -
public class MetricStubGeneratorJob implements IdpTimer {
@Inject
private MetricStubSession metricStubSession;
private TimerStatus status;
public MetricStubGeneratorJob() {
super();
}
public MetricStubGeneratorJob(TimerStatus status) {
this.status = status;
}
...
}
提前致谢!