title: The method sessionManagement() is undefined for the type HeadersConfigurer<HttpSecurity>
body: <p>I am configuring a Spring Boot Oauth2 project an got stuck somewhere at configure method of ResourceServerConfiguration class.</p>
  
  <pre><code>@Override
      public void configure(HttpSecurity http) throws Exception {
  
          http.exceptionHandling()
                  .authenticationEntryPoint(customAuthenticationEntryPoint)
                  .and()
                  .logout()
                  .logoutUrl("/oauth/logout")
                  .logoutSuccessHandler(customLogoutSuccessHandler)
                  .and()
                  .csrf()
                  .requireCsrfProtectionMatcher(
                          new AntPathRequestMatcher("/oauth/authorize"))
                  .disable().headers().frameOptions().disable()
                  .sessionManagement()
                  .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                  .and().authorizeRequests().antMatchers("/hello/")
                  .permitAll().antMatchers("/secure/**").authenticated();
  
      }
  </code></pre>
  
  <p>In the above code, although I have imported</p>
  
  <pre><code>import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.http.SessionCreationPolicy;
  </code></pre>
  
  <p>it shows error at sessionManagement() which says that </p>
  
  <pre><code>The method sessionManagement() is undefined for the type HeadersConfigurer&lt;HttpSecurity&gt;
  </code></pre>
  
  <p><b>Any idea / solution ??</b></p>
  
  <p><b>Thank you !!</b></p>