3 Replies Latest reply on Mar 15, 2013 8:24 AM by mkouba

    injecting app scoped bean in an SystemEventListener

    akostadinov

      Hello,

       

      I was wondering if injecting a an app scoped bean in a system event listener (on e.g. PostConstructApplicationEvent) would be possible? At the moment one needs to resolve it manually from the BeanManager. That's ugly and not convenient.

       

      I already tried but doing it with @Inject results in null.

       

      The use case I have is when for example one has an app scoped bean providing a cache implementation. When this cache needs to be initialized on app startup (for example for a test run) it's better to have a separate class doing that because such operation would not have anything to do with the app logic. I think something can be done with a decorator, I'm not sure but this also doesn't seem right to me.