Results 1 to 7 of 7

Thread: accessing beanFactory from MDB

  1. #1
    Join Date
    Sep 2005
    Location
    Prague, Czech Republic
    Posts
    7

    Default accessing beanFactory from MDB

    hi,

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

    thanks

    -ks-

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

  3. #3
    Join Date
    Sep 2005
    Location
    Prague, Czech Republic
    Posts
    7

    Default

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

    -ks-

  4. #4
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by Calvera
    is beanfactory automagically registered in JNDI?
    No. What exactly are you planning to do?

    Regards,
    Andreas

  5. #5
    Join Date
    Sep 2005
    Location
    Prague, Czech Republic
    Posts
    7

    Default

    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-

  6. #6
    Join Date
    Dec 2004
    Location
    Bucuresti, Romania
    Posts
    72

    Default

    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.

  7. #7
    Join Date
    Sep 2005
    Location
    Prague, Czech Republic
    Posts
    7

Similar Threads

  1. How to implement a custom BeanFactory?
    By ttlaitin in forum Architecture
    Replies: 4
    Last Post: Feb 10th, 2010, 11:24 AM
  2. BeanFactory, FactoryBean and &
    By cherrick in forum Architecture
    Replies: 1
    Last Post: Aug 23rd, 2005, 07:42 PM
  3. Replies: 1
    Last Post: Jul 1st, 2005, 02:48 AM
  4. JNDI BeanFactory lookup
    By edalquist in forum Container
    Replies: 4
    Last Post: Dec 16th, 2004, 02:18 PM
  5. Replies: 2
    Last Post: Aug 27th, 2004, 01:41 AM

Posting Permissions

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