Skip to content

Instantly share code, notes, and snippets.

@SDiamante13
Created March 5, 2020 14:01
Show Gist options
  • Select an option

  • Save SDiamante13/55bac9b8d069f636b8b79db16533f3ac to your computer and use it in GitHub Desktop.

Select an option

Save SDiamante13/55bac9b8d069f636b8b79db16533f3ac to your computer and use it in GitHub Desktop.
A Service that illustrates Dependency Injection
public class CustomerService {
private CustomerRepository customerRepository;
public CustomerService(CustomerRepository customerRepository) {
this.customerRepository = customerRepository;
}
public Customer getCustomerById(long id) {
return customerRepository.findById(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment