Results 1 to 3 of 3

Thread: Application Context closing

  1. #1

    Default Application Context closing

    Hello,

    I'm curious about the exact "contract" that ApplicationContext's have in terms of when they are closed. I understand for a WebApplicationContext that it will close upon receiving event notification from the app-server, but I couldn't see any finalize method implementation (which I know isn't 100% reliable, but when running tests with a Spring app context it would be nice).

    And shouldn't close() be defined as part of the ApplicationContext interface?


    --a Spring proselytizer

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    What do you mean by contract? There is a contract already by default - interface DisposableBean - which has a destroy method that will be closed when the appContext gets closed. Also the destroy attribute which allows you to specify a different method.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3

    Default

    The question is about closing the ApplicationContext--not "destroying" its constituent beans (although AbstractApplicationContext does implement DisposableBean, it doesn't normally apply (see the API))

    If I'm running an unit-test, is there anyway to explicitly close the ApplicationContext (say in the tearDown method), without doing a cast to AbstractApplicationContext, and is it necessary to explicitly invoke close() on it?

Similar Threads

  1. Closing Application Context
    By Richard.F in forum EJB
    Replies: 2
    Last Post: Sep 2nd, 2005, 04:03 AM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  4. Replies: 6
    Last Post: May 8th, 2005, 11:09 AM
  5. Questioning the core component
    By Martin Kersten in forum Swing
    Replies: 6
    Last Post: Feb 21st, 2005, 03:45 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
  •