title: Java Spring Security - User.withDefaultPasswordEncoder() is deprecated?
body: <p>I am very new to java spring security, and was following the Spring.io <a href="https://spring.io/guides/gs/securing-web/" rel="noreferrer">tutorial guide</a>.
  As part of this, I edited the <code>WebSecurityConfig</code> class as required:</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
      @Override
      protected void configure(HttpSecurity http) throws Exception {
        http
          .authorizeRequests()
              .antMatchers("/", "/home").permitAll()
              .anyRequest().authenticated()
              .and()
          .formLogin()
              .loginPage("/login")
              .permitAll()
              .and()
          .logout()
              .permitAll();
      }
  
      @Bean
      @Override
      public UserDetailsService userDetailsService() {
          UserDetails user =
           User.withDefaultPasswordEncoder()
              .username("user")
              .password("password")
              .roles("USER")
              .build();
  
      return new InMemoryUserDetailsManager(user);
      }
  }
  </code></pre>
  
  <p>Within the <code>userDetailService()</code> method,  it uses <code>withDefaultPasswordEncoder()</code> which is now deprecated as seen in the docs: <a href="https://docs.spring.io/spring-security/site/docs/5.0.x/api/org/springframework/security/core/userdetails/User.html#withDefaultPasswordEncoder--" rel="noreferrer">withDefaultPasswordEncoder()</a></p>
  
  <p>Unfortunately, I have not been able to find an alternative to this, to complete this tutorial without using the deprecated method.
  Would somebody be able to provide an alternative for this  if possible? </p>
  
  <p>Thanks! </p>
  
  <p><strong><em>note:</em></strong> I have attached a couple of screen shots of my error, as well as my gradle file</p>
  
  <p><img src="https://i.stack.imgur.com/PSwKD.png" alt="image 1: The error I am receiving"></p>
  
  <p><img src="https://i.stack.imgur.com/8lCU3.png" alt="image 2: My gradle file"></p>