title: Class file for org.springframework.security.authentication.encoding.PasswordEncoder not found
body: <p>I've made a simple restAPI with Spring-boot and spring security, implementing Basic Authentication. I want to use inMemoryAuthentication, and bcryptPasswordEncoder, but for some reason my compiler is looking for the passwordEncoder in the wrong place, See title vs security.crypto.password.PasswordEncoder. </p>
  
  <p>My Basic auth looks like this:</p>
  
  <pre><code>import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import org.springframework.security.config.http.SessionCreationPolicy;
  import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
  import org.springframework.security.crypto.password.PasswordEncoder;    
  Configuration
      @EnableWebSecurity
      public class BasicAuthConfig extends WebSecurityConfigurerAdapter {
        // Authentication : User --&gt; Roles
        // NoOpPasswordEncoder has been deprecated in Spring security so {noop} is being used to avoid errors
        protected void configure(AuthenticationManagerBuilder auth)
          throws Exception {
          auth.inMemoryAuthentication()
            .passwordEncoder(passwordEncoder())
            .withUser("user1")
              .password("{noop}secret1")
              .roles("USER")
            .and().withUser("admin1")
              .password("{noop}secret1")
              .roles("USER", "ADMIN");
        }
  
        // Authorization : Role -&gt; Access
        protected void configure(HttpSecurity http) throws Exception {
          http
            .httpBasic()
            .and().authorizeRequests()
              .antMatchers("/tokenservice/**")
                .hasRole("USER")
              .antMatchers("/**")
                .hasRole("ADMIN")
            .and().csrf()
            .disable()
              .headers()
              .frameOptions()
            .and().disable()
              .sessionManagement()
              .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
        }
        @Bean
        public PasswordEncoder passwordEncoder(){
          return new BCryptPasswordEncoder();
        }
      }
  </code></pre>
  
  <p>I get this error when trying to compile:</p>
  
  <blockquote>
    <p>Error:(21, 7) java: cannot access org.springframework.security.authentication.encoding.PasswordEncoder
      class file for org.springframework.security.authentication.encoding.PasswordEncoder not found</p>
  </blockquote>
  
  <p>Disregard the {noop} in front of the password. is there for testing without passwordEncoder.</p>
  
  <p>I'm very new to Spring and gradle, and java all in all. Could i be using a wrong version of Spring? If thats the case, how do i fix it?</p>