Skip to content

Instantly share code, notes, and snippets.

@lordofthejars
Created June 4, 2018 10:20
Show Gist options
  • Save lordofthejars/d935973b6edea12f76d40bf79e4986f2 to your computer and use it in GitHub Desktop.
Save lordofthejars/d935973b6edea12f76d40bf79e4986f2 to your computer and use it in GitHub Desktop.
@RestController
public class CustomerController {
@Autowired
CustomerRepository customerRepository;
@GetMapping("/init")
public void initializeDb() {
customerRepository.save(new Customer("Alex", ""));
customerRepository.save(new Customer("Ada", ""));
customerRepository.save(new Customer("Alexandra", ""));
}
@GetMapping("/customer")
public @ResponseBody Iterable<Customer> getCustomers() {
return customerRepository.findAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment