1 Reply Latest reply on Jun 18, 2014 11:34 AM by gimbal2

    ApplicationContext instance ClassPathXmlApplicationContext using Spring


      I don't know where to put this.  The Spring forum is closed to new registrants.  Which is too bad for me because I'm just starting out with Spring.



      I'm trying to instantiate an ApplicationContext in Eclipse.  I've got spring-context-3.2.0.RELEASE.jar, and spring-beans-3.2.0.RELEASE both on my classpath,



      ApplicationContext context = new ClassPathXmlApplicationContext("classpath:test-config.xml");



      There are two error messages the IDE is showing.  And I'm having trouble with both



      1) "Resource leak: 'context' is never closed."

        But I don't see a "close" method for ApplicationContext, so how do I address that?

      2) "Unhandled exception type BeansException."  So I surround the line with a try block



      ApplicationContext context;

        try {

        context = new ClassPathXmlApplicationContext("classpath:test-config.xml");

        } catch (BeansException e) {

        // TODO Auto-generated catch block





      But now the error is "the method printStackTrace is undefined for BeansException"?

      Can anyone help?

      The core issue is that I've got this ApplicationContext line working in another workspace, admittedly with a different build path, and I'm not using a try block with it, so I'm not sure what I need to do..  Any help would be appreciated.