title: How to transform deprecated WebSecurityConfigurerAdapter to SecurityFilterChain?
body: <p>I'm working on a project and my problem is the WebSecurityConfigurerAdapter. It's doesn't work. It's say &quot;The type WebSecurityConfigurerAdapter is deprecated&quot; How to transform deprecated WebSecurityConfigurerAdapter to SecurityFilterChain? Can you help me please? I don't know what to do</p>
  <p>Here is my WebSecurityConfig class :</p>
  <pre><code>package com.projectuas.controller;
  import com.projectuas.service.UserDetailsServiceImpl;
  
  import org.springframework.context.annotation.*;
  import org.springframework.security.authentication.dao.*;
  import org.springframework.security.config.annotation.authentication.builders.*;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.*;
  import org.springframework.security.core.userdetails.UserDetailsService;
  import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
   
  @Configuration
  @EnableWebSecurity
  public class WebSecurityConfig  extends WebSecurityConfigurerAdapter {
   
      @Bean
      public UserDetailsService userDetailsService() {
          return new UserDetailsServiceImpl();
      }
       
      @Bean
      public BCryptPasswordEncoder passwordEncoder() {
          return new BCryptPasswordEncoder();
      }
       
      @Bean
      public DaoAuthenticationProvider authenticationProvider() {
          DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
          authProvider.setUserDetailsService(userDetailsService());
          authProvider.setPasswordEncoder(passwordEncoder());
           
          return authProvider;
      }
  
  
  @Overide
  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
      auth.authenticationProvider(authenticationProvider());
  }
  
  @Overide
  protected void configure(HttpSecurity http) throws Exception {
      http.authorizeRequests()
          .antMatchers(&quot;/&quot;).hasAnyAuthority(&quot;USER&quot;, &quot;ADMIN&quot;)
          .antMatchers(&quot;/new&quot;).hasAnyAuthority(&quot;ADMIN&quot;)
          .antMatchers(&quot;/edit/**&quot;).hasAnyAuthority(&quot;ADMIN&quot;)
          .antMatchers(&quot;/delete/**&quot;).hasAuthority(&quot;ADMIN&quot;)
          .anyRequest().authenticated()
          .and()
          .formLogin().permitAll()
          .and()
          .logout().permitAll()
          .and()
          .exceptionHandling().accessDeniedPage(&quot;/403&quot;)
          ;
  }
  }
  </code></pre>