title: Why PreDestroy method doesn't work
body: <p>I have a basic spring project with simple configuration. This is bean</p>
  
  <pre><code>public class GreetingServiceImpl implements GreetingService {
      private final Log log = LogFactory.getLog(getClass());
  
      @Override
      public String hello() {
          return "Hello";
      }
  
      private void init() {
          log.info("GreetingServiceImpl INIT");
      }
  
      private void destroy() {
          log.info("GreetingServiceImpl DESTROY");
      }
  }
  </code></pre>
  
  <p>configuration:</p>
  
  <pre><code>&lt;bean id="greetingService"
        class="com.example.hello.GreetingServiceImpl"
        init-method="init"
        destroy-method="destroy"&gt;
  </code></pre>
  
  <p>And this is my test code:</p>
  
  <pre><code>@Test
  public void greeting() {
      ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("applicationConfig.xml");
      GreetingService greetingService = context.getBean(GreetingService.class);
  
      Assert.assertEquals("Hello", greetingService.hello());
      context.close();
  }
  </code></pre>
  
  <p>When I run this code I don't see destroy method in logs as well as context closing.</p>
  
  <pre><code>org.springframework.context.support.AbstractApplicationContext prepareRefresh
  Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2be94b0f
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  Loading XML bean definitions from class path resource [applicationConfig.xml]
  com.example.hello.GreetingServiceImpl init
  GreetingServiceImpl INIT
  
  Process finished with exit code 0
  </code></pre>
  
  <p>I tried to call <code>registerShutdownHook</code> and <code>refresh</code> but result was the same.</p>