title: using registerShutdownHook() in the Spring Framework
body: <p>I am following this tutorial online to the letter.
  <a href="http://www.tutorialspoint.com/spring/spring_bean_life_cycle.htm" rel="nofollow noreferrer">http://www.tutorialspoint.com/spring/spring_bean_life_cycle.htm</a></p>
  
  <p>But I get the errors when using Eclipse
  when I get to this line:
  context.registerShutdownHook();</p>
  
  <p>Eclipse says:</p>
  
  <p>"Multiple markers at this line
    - Syntax error, insert "AssignmentOperator Expression" to complete 
       Assignment
    - Syntax error, insert ";" to complete Statement
    - The method registerShutdownHook() is undefined for the type 
       ApplicationContext"</p>
  
  <p>I am following this tutorial exactly. All of my variable names are exactly the same.My code is exactly the same as his. I am not sure what is wrong. </p>
  
  <p>What am I doing wrong, what can be done to fix this so that I can continue the tutorial.</p>
  
  <pre><code>package com.tutorialspoint;
  
  import org.springframework.context.support.AbstractApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  public class MainApp
  {
      public static void main(String[] args)
      {
          AbstractApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
  
          HelloWorld obj = (HelloWorld)context.getBean("helloWorld");
          obj.getMessage();
          context.registerShutdownHook();
      }
  }
  </code></pre>