Spring Security 5 : No Beans of type BCryptPasswordEncoder found

The article you mentioned describes it a little bit further:

There is no default instance of BCryptPasswordEncoder that can be injected in the UserController class

And later in code

@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
    return new BCryptPasswordEncoder();
}

Did you follow these steps and do you define a BCryptPasswordEncoder class?


add it like this in your main application class

    @SpringBootApplication
    public class YourApplicationName{

        public static void main(String[] args) {
            SpringApplication.run(MobileAppWsApplication.class, args);
        }
        @Bean
        public BCryptPasswordEncoder bCryptPasswordEncoder() {
            return new BCryptPasswordEncoder();
        }
}