Results 1 to 2 of 2

Thread: How to obtain the beanFactory from a Web app

  1. #1
    Join Date
    Nov 2004
    Posts
    3

    Default How to obtain the beanFactory from a Web app

    I am using Quartz to schedule some jobs in a web application. The class that implements the job needs a reference to an object defined in the application context (applicationContext.xml). I first tried to use the WebApplicationContextUtils class to obtain the bean factory but I don't have the ServletContext......The other possibility would be to use the SingletonBeanFactoryLocator but I don't want to load the application context again since it is already loaded. I would like to know if there is a possibility to obtain the bean factory without having the ServletContext.
    Thanks...

  2. #2
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    71

    Default

    if the class is created by Spring you can implement ApplicationContextAware interface and then set a reference to the application context (setApplicationContext will be called by the bean factory when it creates this object)

    if you are using a QuartzJobBean extension created by Spring you can implement ApplicationContextAware and set a refencence in the implementing class when it the job bean creates it.

Similar Threads

  1. MDB and BeanFactory
    By vichandoko in forum Container
    Replies: 1
    Last Post: Sep 14th, 2005, 01:06 AM
  2. BeanFactory, FactoryBean and &
    By cherrick in forum Architecture
    Replies: 1
    Last Post: Aug 23rd, 2005, 07:42 PM
  3. JNDI BeanFactory lookup
    By edalquist in forum Container
    Replies: 4
    Last Post: Dec 16th, 2004, 02:18 PM
  4. Root of BeanFactory hierarchy
    By wangdongzjk in forum Data
    Replies: 3
    Last Post: Nov 28th, 2004, 10:33 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
  •