Skip to content

Instantly share code, notes, and snippets.

public class D_DependencyInversionProblem {
@AllArgsConstructor
private static class AuthenticateLogin {
public boolean login(User user){
AuthenticationLinkedin authentication = new AuthenticationLinkedin();
return authentication.login(user);
}
}
public class D_DependencyInversionSolution {
@AllArgsConstructor
private static class AuthenticateLogin {
private final Authentication authentication;
public boolean login(User user){
return authentication.login(user);
}
}
public class D_DependencyInversionSolution {
private static class AuthenticateLogin {
private final Authentication authentication;
private AuthenticateLogin(Authentication authentication) {
this.authentication = authentication;
}
public boolean login(User user){