Skip to content

Instantly share code, notes, and snippets.

@ugurcemozturk
Last active December 6, 2017 13:38
Show Gist options
  • Save ugurcemozturk/1ce4f9463f08df53c9526db96a6b415b to your computer and use it in GitHub Desktop.
Save ugurcemozturk/1ce4f9463f08df53c9526db96a6b415b to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/developers")
public class DeveloperController {
private DeveloperRepository developerRepository;
private BCryptPasswordEncoder bCryptPasswordEncoder;
public DeveloperController(DeveloperRepository developerRepository,
BCryptPasswordEncoder bCryptPasswordEncoder) {
this.developerRepository = developerRepository;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@RequestMapping(value = "/sign-up", method = RequestMethod.POST)
public void signUp(@RequestBody Developer developer) {
developer.setPassword(bCryptPasswordEncoder.encode(developer.getPassword()));
developerRepository.save(developer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment