title: Using Bcrypt in Spring
body: <p>I am doing a local login and right know my password is stored on an h2 databse in plain text.</p>
  
  <p>I want to use the <code>Bcrypt</code> in spring but I get this error on my application launch:</p>
  
  <pre><code>Field bCryptPasswordEncoder in com.alert.interservices.uaa.Bootstrap required a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' that could not be found.
  </code></pre>
  
  <p>To use <code>Bcrypt</code> I only Autowired it in my controller and encrypt the password.
  I did the same on my Bootstrap when filling the database:</p>
  
  <p>Controller:</p>
  
  <pre><code>@Autowired
  private BCryptPasswordEncoder bCryptPasswordEncoder;
  
  /**
   * 
   * @param user the user that is trying to access
   * @return the user if it is successfull or a bad request if not
   */
  @RequestMapping(value = "/authenticate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
  public Object authenticate(@RequestBody UserEntity user) {
  
      logger.debug("Begin request UAAController.authenticate()");
  
      String encriptedPasswd=bCryptPasswordEncoder.encode(user.getPassword().getPassword());
  
      UserEntity usr = authenticationService.authenticate(user.getName(), encriptedPasswd);
  
      (...)
  </code></pre>
  
  <p>Bootstrap:</p>
  
  <pre><code>@Autowired
  private BCryptPasswordEncoder bCryptPasswordEncoder;
  
  @GetMapping("/test")
  public void fillDatabse() {
  
  
      String encodedPw=bCryptPasswordEncoder.encode("test");
      Password p = new Password(encodedPw);
  </code></pre>
  
  <p>What Im I doing wrong?</p>