Announcement Announcement Module
Collapse
No announcement yet.
accessing beanFactory from MDB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • accessing beanFactory from MDB

    hi,

    how do i access BeanFactory in MDB? could someone suggest me 'best practice'?

    thanks

    -ks-

  • #2
    You can just extend org.springframework.ejb.support.AbstractJmsMessage DrivenBean.

    See here for an example (it's about session beans, but should be easily adapted).

    Regards,
    Andreas

    Comment


    • #3
      is beanfactory automagically registered in JNDI? if not, how to do it?
      sorry for inconvenience, i can't find it in doc...

      -ks-

      Comment


      • #4
        Originally posted by Calvera
        is beanfactory automagically registered in JNDI?
        No. What exactly are you planning to do?

        Regards,
        Andreas

        Comment


        • #5
          i need to access my (Hibernate or JDBC) DAO classes in MDB. i'm looking for the best solution.

          i have my application in WAR file. perhaps i need to deploy it in EAR (because of MDBs and common libs). so i want to know if i can use one BeanFactory for whole app or one BF for webapp and one for EJBs...

          thanks a lot...

          -ks-

          Comment


          • #6
            I think you should do somthing like this:
            Code:
            public MyMdb extends AbstractJmsMessageDrivenBean {
            
            	public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) {
            super.setMessageDrivenContext(messageDrivenContext);  setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance());
            setBeanFactoryLocatorKey("myPrmaryContext");
            }
            .......
            
            }
            This code uses a singleton application context. For more info please consult chapter 16.2 of the Spring refeence docs.

            Comment


            • #7
              i found it here http://www.javaworld.com/javaworld/j...springejb.html

              Comment

              Working...
              X