In a spring MVC application, I initialize a variable in one of the service classes using the following approach:
ApplicationContext context =
new C
As the Application context has an instance of ClassPathXmlApplicationContext and the same has a close() method. I would simply CAST the appContext object and invoke the close() method as below.
ApplicationContext appContext = new ClassPathXmlApplicationContext("spring.xml");
//do some logic
((ClassPathXmlApplicationContext) appContext).close();
This will fix the Resource Leak warning.