2 Replies Latest reply on Jan 24, 2011 11:01 AM by adamw

    Injecting dependencies to RevisionListener

    apph_

      Hi,

       

      I have a question about providing some additional data to my implementation of RevisionListener interface. In our case we use Spring and have some components that can retrieve information about currently logged user. The problem is we can't inject that bean directly (Envers creates instance of the RevisionListener implementation at runtime) nor inject Spring context and retrieve that bean.

      As a workaround we have a class which is a Spring component with a static method. This class is used in our listener and delegates user search to appropriate component. I see that in examples where Seam is used, it's problably a similar solution (Component class and a static getInstance method).

      Do you see any better solutions to this problem?

       

      Regards