Skip to content

Instantly share code, notes, and snippets.

@trimoq
Last active January 8, 2020 13:57
Show Gist options
  • Save trimoq/94bdce91076ebbc73b2577411219ceed to your computer and use it in GitHub Desktop.
Save trimoq/94bdce91076ebbc73b2577411219ceed to your computer and use it in GitHub Desktop.
UserService taking care of its dependencies
public class UserService{
private UserRepository userRepository;
public UserService(){
this.userRepository = PostgresUserRepository.getInstance();
}
public void addUser(String name){
// do some business logic here
userRepository.addUser(name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment