Created
March 5, 2020 14:01
-
-
Save SDiamante13/55bac9b8d069f636b8b79db16533f3ac to your computer and use it in GitHub Desktop.
A Service that illustrates Dependency Injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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