Announcement Announcement Module
Collapse
No announcement yet.
Injecting a POJO into an EJB3 SLSB with Spring 2.0.8 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Injecting a POJO into an EJB3 SLSB with Spring 2.0.8

    Hello,

    I want to inject a POJO into an EJB3 Stateless Session Bean with Spring 2.0.8 (I have to stick with this version because of JDO 1.0 compatibility).

    I have found some resources on the net but no complete example, so I'm missing the big picture. Basically I have a Service-Interface "Service". This interface is implemented by the "ServiceImpl"-Pojo and the EJB. The EJB is called by a Java client and delegates all service calls to the service implementation. I understand, that I should use the Configurable annotation to inject the "ServiceImpl" - POJO into my EJB, so my classes look like this:

    Service:
    Code:
    public interface Service
    {
       public String sayHello();
    }
    ServiceImpl:
    Code:
    public class ServiceImpl implements Service
    {
       public String sayHello()
       {
           return "Hello World!";
       }
    }
    ServiceEJB:
    Code:
    Configurable
    Stateless
    Remote(Service.class)
    public class ServiceEJB implements Service
    {
        private Service service;
    
        public String sayHello()
        {
             service.sayHello();
        }
    }
    I guess that the Configurable annotation causes Spring to instantiate a bean-factory in the background, but what I do not understand is where it is looking for the configuration file?

    So I'm a bit confused how these components are "glued" together and what effects the Configurable annotation really has.
    I hope that someone can help me.

    Thank's in advance!

  • #2
    Looking for some example application using Spring and Hibernate

    Looking for some example application using Spring and Hibernate

    Guddu

    Comment


    • #3
      Can I use EJB3 and Hibernate as Persistence mapping?

      Can I use EJB3 and Hibernate as Persistence mapping?

      Thanks,
      Guddu
      http://www.interview-questions-tips-...xample/Example

      Comment

      Working...
      X