title: Spring GetMapping returns view but PostMapping returns error
body: <p>Absolutely beginner question about Java Spring. This is my controller:</p>
  
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PostMapping;
  
  @Controller
  public class HomeController {
  
      @GetMapping("ahome")
      public String getHome() {
          System.out.println("get");
          return "home";
      }
  
      @PostMapping("ahome")
      public String postHome() {
          System.out.println("post");
          return "home";
      }
  }
  </code></pre>
  
  <p>"home" is home.html in "views" folder and in my application.properties file there are two lines:</p>
  
  <pre><code>spring.mvc.view.prefix=/views/
  spring.mvc.view.suffix=.html
  </code></pre>
  
  <p>When I go to "<a href="http://localhost:8080/ahome" rel="nofollow noreferrer">http://localhost:8080/ahome</a> my GetMapping method works and returns view home.html
  There is simple form in this view, and when I hit "submit" button in this form it goes to my PostMapping method and it works ("System.out.println("post")) prints "post" BUT instead of returning view home.html it returns an error "Request method 'POST' not supported".</p>
  
  <p>Why is this happening?
  What should I do to return view by PostMapping?</p>