Announcement Announcement Module
Collapse
No announcement yet.
How to handle exceptions in FileSystemXmlApplicationContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to handle exceptions in FileSystemXmlApplicationContext

    Hi guys.

    I have this problem. If a runtime exception(eg. NullPointerException) happens anywhere in my spring context, is there a way I can know about it and handle it accordingly. In the web framework for my websystems I used HandlerExceptionResolver which handles exceptions thrown by the handlers.

    Is ther a simmilar way I can now about the exceptions in the spring context.

    Thanks

    Gawie

  • #2
    If a runtime exception(eg. NullPointerException) happens anywhere in my spring context, is there a way I can know about it
    If it is a configuration issue, you can try Spring IDE and avoid it.

    Comment


    • #3
      Gawie,

      There is no way to intercept Exceptions, or try to repair the issue dynamically (i.e. get involved inside the context code).

      When you load an application context, and it is unable to load because of an error during basic loading, you'll get a BeansException of some sort, and the context should be considered unusable.

      On the other hand, if a context has already been loaded, and you (directly or indirectly) issue a getBean() call, and that results in an Exception for whatever reason (which will be thrown back to you btw), the context is still usable

      Regards,

      Comment


      • #4
        thanks for the help

        Comment

        Working...
        X