Injecting a SessionScoped Stateful bean in EntityListener
问题 I'm trying to implement some sort of auditing in a Java EE JPA application on GlassFish 3. I have added a @EntityListeners annotation on my @MappedSuperclass entity, the listener has the @PrePersist and @PreUpdate annotation on its methods which are invoked happily at runtime. In these methods, I'm trying to use ( @Inject ) a @Named , @Stateful , @SessionScoped bean ( UserSession ) in order to get current user's id. The listener class has no annotations at all. The problem is that I can't get