title: @RestController password encrytion and sending data in json with hibernate
body: <p>I create a login/registration form in angularjs and use spring boot. When i register a user i use following code to send the data to the database:</p>
  
  <pre><code>   @RequestMapping(value = "/register",method = RequestMethod.POST)
      public User addUser(@RequestBody User user) {
          LOGGER.info("Received request to create the {}", user);
          return repo.saveAndFlush(user);
      }
  </code></pre>
  
  <p>How can i encrypt the password into the database ?</p>
  
  <p>Then i also want to create something similar for the login.
  But how do i get the stuff  back from the server in json format to angularjs.
  Is this secure. And how to handle a password encryption?
  Is it also possible to hide the password while validating?</p>