Results 1 to 2 of 2

Thread: How to create app.context even when some bean creation fails

  1. #1
    Join Date
    Aug 2004
    Location
    Brno, Czech Republic
    Posts
    48

    Default How to create app.context even when some bean creation fails

    Hi,

    I use RmiProxyFactoryBean for using RMI services in my web app. Those services are used for DB synchronization which is triggered by TimerTasks from time to time.

    I want my application to be able to start up even when the remote services are not available. I have marked the remote service beans as lazy-init="true" and with this setup it is possible to create the context using ClassPathXmlApplicationContext() from my unit tests even without the remote connection.

    But when the application context is created from my web app using ContextLoaderListener filter and WebApplicationContextUtils.getWebApplicationContex t() it fails. It seems it is ignoring the lazy-init flag. :?

    How to ensure the creation of application context even if some "non mandatory" beans creation fails?

    TIA,
    Karel

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    The lazy-init flag is never ignored, but keep in mind that if some other bean, which iitself a singleton and thus pre-iinitialized is referring to the lazy-init one, the lazy-init one will have to be created at that time as well. I think in your real (as opposed to unit test) setup, you have another bean referring to the rmi proy bean.

    One option would be to set this other bean to be lazy as well, but that really depends on your use case...

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

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