title: HTTP Status 405 - Request method 'PUT' not supported
body: <p>I have the following controller:</p>
  
  <pre><code>@RestController
  public class RestaurantController {
      @Autowired
      RestaurantService restaurantService;
      @RequestMapping(value = "/restaurant/", method = RequestMethod.GET)
      public ResponseEntity&lt;List&lt;Restaurant&gt;&gt; listAllRestaurants() {
          System.out.println("Fetching all restaurants");
          List&lt;Restaurant&gt; restaurants = restaurantService.findAllRestaurants();
          if(restaurants.isEmpty()){
              return new ResponseEntity&lt;List&lt;Restaurant&gt;&gt;(HttpStatus.NO_CONTENT);//You many decide to return HttpStatus.NOT_FOUND
          }
          return new ResponseEntity&lt;List&lt;Restaurant&gt;&gt;(restaurants, HttpStatus.OK);
      }
      @RequestMapping(value = "/restaurant/{id}", method = RequestMethod.PUT)
      public ResponseEntity&lt;Restaurant&gt; updateRestaurant(@PathVariable("id") int id, @RequestBody Restaurant restaurant) {
          System.out.println("Updating Restaurant " + id);
  
          Restaurant currentRestaurant = restaurantService.findById(id);
  
          if (currentRestaurant==null) {
              System.out.println("Restaurant with id " + id + " not found");
              return new ResponseEntity&lt;Restaurant&gt;(HttpStatus.NOT_FOUND);
          }
  
          currentRestaurant.setName(restaurant.getName());
          currentRestaurant.setDescription(restaurant.getDescription());
          currentRestaurant.setIcon(restaurant.getIcon());
  
          restaurantService.updateRestaurant(currentRestaurant);
          return new ResponseEntity&lt;Restaurant&gt;(currentRestaurant, HttpStatus.OK);
      }
  }
  </code></pre>
  
  <p>Here is my calls from the PostMan.
  First I am making the GET call to get all the restaurants and it works fine
  <a href="https://i.stack.imgur.com/3zK7P.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3zK7P.png" alt="enter image description here"></a>
  Second I am trying to update the object by I am getting the following error.
  <a href="https://i.stack.imgur.com/0rUfF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0rUfF.png" alt="enter image description here"></a>
  At the Tomcat 8.0.32, I am getting the following log:</p>
  
  <blockquote>
    <p>13-Feb-2016 16:55:09.442 WARNING [http-apr-8080-exec-9]
    org.springframework.web.servlet.PageNotFound.handleHttpRequestMethodNotSupported
    Request method 'PUT' not supported</p>
  </blockquote>
  
  <p>I don't understand this is how possible.
  And here is my dependencies:</p>
  
  <pre><code>&lt;properties&gt;
          &lt;springframework.version&gt;4.1.6.RELEASE&lt;/springframework.version&gt;
          &lt;springsecurity.version&gt;4.0.1.RELEASE&lt;/springsecurity.version&gt;
          &lt;hibernate.version&gt;4.3.6.Final&lt;/hibernate.version&gt;
          &lt;mysql.connector.version&gt;5.1.31&lt;/mysql.connector.version&gt;
          &lt;jackson.version&gt;2.6.3&lt;/jackson.version&gt;
          &lt;joda-time.version&gt;2.3&lt;/joda-time.version&gt;
          &lt;testng.version&gt;6.9.4&lt;/testng.version&gt;
          &lt;mockito.version&gt;1.10.19&lt;/mockito.version&gt;
          &lt;h2.version&gt;1.4.187&lt;/h2.version&gt;
          &lt;dbunit.version&gt;2.2&lt;/dbunit.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Hibernate --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- jsr303 validation --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;5.1.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- MySQL --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;${mysql.connector.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Joda-Time --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;joda-time&lt;/groupId&gt;
              &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
              &lt;version&gt;${joda-time.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- To map JodaTime with database type --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jadira.usertype&lt;/groupId&gt;
              &lt;artifactId&gt;usertype.core&lt;/artifactId&gt;
              &lt;version&gt;3.0.0.CR1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring Security --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${springsecurity.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${springsecurity.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Servlet+JSP+JSTL --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet.jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.3.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Need this for json to/from object --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Testing dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;${testng.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mockito&lt;/groupId&gt;
              &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
              &lt;version&gt;${mockito.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;version&gt;${h2.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;dbunit&lt;/groupId&gt;
              &lt;artifactId&gt;dbunit&lt;/artifactId&gt;
              &lt;version&gt;${dbunit.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>If more information is needed please tell me! Thanks.</p>
  
  <p>Edit 1:</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
  
  
      @Autowired
      public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
          auth.inMemoryAuthentication().withUser("bill").password("user").roles("USER");
          auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN");
          auth.inMemoryAuthentication().withUser("dba").password("dba").roles("ADMIN","DBA");
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
  
        http.authorizeRequests()
          .antMatchers("/", "/home","/restaurant/**").permitAll()
          .antMatchers("/list").access("hasRole('USER')")
          .antMatchers("/list").access("hasRole('ADMIN')")
          .antMatchers("/admin/**").access("hasRole('ADMIN')")
          .antMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')")
          .and().formLogin().loginPage("/login")
          .usernameParameter("ssoId").passwordParameter("password")
          .and().csrf()
          .and().exceptionHandling().accessDeniedPage("/Access_Denied");
      }
  }
  </code></pre>
  
  <p>Edit 2:</p>
  
  <blockquote>
    <p>2016-02-14 12:30:56 DEBUG FilterChainProxy:324 - /restaurant/1 at
    position 1 of 12 in additional filter chain; firing Filter:
    'WebAsyncManagerIntegrationFilter'</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    FilterChainProxy:324 - /restaurant/1 at position 2 of 12 in additional
    filter chain; firing Filter: 'SecurityContextPersistenceFilter'</p>
    
    <p>2016-02-14 12:30:56 DEBUG HttpSessionSecurityContextRepository:159 -
    No HttpSession currently exists</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    HttpSessionSecurityContextRepository:101 - No SecurityContext was
    available from the HttpSession: null. A new one will be created.</p>
    
    <p>2016-02-14 12:30:56 DEBUG FilterChainProxy:324 - /restaurant/1 at
    position 3 of 12 in additional filter chain; firing Filter:
    'HeaderWriterFilter'</p>
    
    <p>2016-02-14 12:30:56 DEBUG HstsHeaderWriter:128 -
    Not injecting HSTS header since it did not match the requestMatcher
    org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@3ded3d8a</p>
    
    <p>2016-02-14 12:30:56 DEBUG FilterChainProxy:324 - /restaurant/1 at
    position 4 of 12 in additional filter chain; firing Filter:
    'CsrfFilter'</p>
    
    <p>2016-02-14 12:30:56 DEBUG CsrfFilter:106 - Invalid CSRF
    token found for
    <a href="http://localhost:8080/SpringSecurityCusotmLoginFormAnnotationExample/restaurant/1" rel="noreferrer">http://localhost:8080/SpringSecurityCusotmLoginFormAnnotationExample/restaurant/1</a></p>
    
    <p>2016-02-14 12:30:56 DEBUG DispatcherServlet:861 - DispatcherServlet
    with name 'dispatcher' processing PUT request for
    [/SpringSecurityCusotmLoginFormAnnotationExample/Access_Denied]</p>
    
    <p>2016-02-14 12:30:56 DEBUG RequestMappingHandlerMapping:294 - Looking
    up handler method for path /Access_Denied</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    ExceptionHandlerExceptionResolver:134 - Resolving exception from
    handler [null]:
    org.springframework.web.HttpRequestMethodNotSupportedException:
    Request method 'PUT' not supported</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    ResponseStatusExceptionResolver:134 - Resolving exception from handler
    [null]:
    org.springframework.web.HttpRequestMethodNotSupportedException:
    Request method 'PUT' not supported</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    DefaultHandlerExceptionResolver:134 - Resolving exception from handler
    [null]:
    org.springframework.web.HttpRequestMethodNotSupportedException:
    Request method 'PUT' not supported</p>
    
    <p>2016-02-14 12:30:56 WARN 
    PageNotFound:198 - Request method 'PUT' not supported</p>
    
    <p>2016-02-14 12:30:56 DEBUG HttpSessionSecurityContextRepository:337 -
    SecurityContext is empty or contents are anonymous - context will not
    be stored in HttpSession.</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    DispatcherServlet:1034 - Null ModelAndView returned to
    DispatcherServlet with name 'dispatcher': assuming HandlerAdapter
    completed request handling</p>
    
    <p>2016-02-14 12:30:56 DEBUG
    DispatcherServlet:996 - Successfully completed request</p>
    
    <p>2016-02-14 12:30:56 DEBUG DefaultListableBeanFactory:248 - Returning cached
    instance of singleton bean 'delegatingApplicationListener'</p>
    
    <p>2016-02-14 12:30:56 DEBUG HttpSessionSecurityContextRepository:337 -
    SecurityContext is empty or contents are anonymous - context will not
    be stored in HttpSession. </p>
    
    <p>2016-02-14 12:30:56 DEBUG
    SecurityContextPersistenceFilter:105 - SecurityContextHolder now
    cleared, as request processing completed</p>
  </blockquote>