1 Reply Latest reply on Dec 16, 2006 6:27 AM by alesj

    EJB3 SLSB from Spring MVC

    leetgeezer

      Hello,

      I am designing an app using Spring MVC + EJB3. Both Web and EJB modules get packaged into MyApp.ear and deployed into JBoss 4.0.5GA. Currently, to reference the stateless session bean (local if.) from one of the Controllers, I say:

       InitialContext ctx = new InitialContext();
       userService = (UserService) ctx.lookup(
       "MyApp/UserServiceBean/local");
      


      What I don't like, however, is that this method relies on "MyApp/UserServiceBean/local" string (What if, say, MyApp name changes?)

      My question is: is there any better way (DI?) to reference the stateless session bean locally? I checked Spring's LocalStatelessSessionProxyFactoryBean but it appears that it applies to EJB 2.1 (Home IF's & stuff). Does @EJB or @Resource apply here?

      Regards,
      Leet Geezer