Results 1 to 2 of 2

Thread: Injecting Spring bean to EJB3 SLSB without @Autowired Annotation

  1. #1

    Default Injecting Spring bean to EJB3 SLSB without @Autowired Annotation

    Hi,
    I need to develop an EJB(SLSB), which has a DAO reference.

    Code:
    @stateless
    class MyFirstEJB3 implements FirstEJB3Remote
    {
       private MyDAO dao;
       //setter
    
    }
    Now i want to configure these beans in spring applicationContext.xml.

    As i am not using Annotations for all other beans(i am configuring using XML), to maintain consistency, i want to configure these beans also through XML.

    In spring-reference manual, i found that it can be done using @Interceptors(SpringBeanAutowiringInterceptor.clas s)on MyFirstEJB3 and @Autowired on MyDAO.

    Is there any other way to configure it, so that when i access my EJB, i should get the EJB with DAO has been set.
    Thanks,
    K. Siva Prasad Reddy

  2. #2
    Join Date
    Mar 2007
    Location
    Poland
    Posts
    341

    Default

    So first of all: EJBs are objects created by Ejb container and Spring can do nothing about it. it means that if ejbs are created spring can not postprocess them as it does for their own created beans.

    Till EJB 3 the only way to integrate EJB and Spring was to manually retrieve spring beans from Spring context in EJBs.
    Using EJB 3 Interceptor Spring can process @Autowired annotations and inject Spring dependencies to your EJBs.
    I do not know exactly which annotations you would like to avoid : Spring ones or EJBs ones ? or maybe both

    In the latter case the only soultion i can think of is using Spring EJB 2.1 support classes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •