반응형
팩토리 패턴
-
spring factory patternTech/SpringBoot 2020. 10. 19. 23:46
Factory 패턴: 하위 클래스가 어떤 객체를 생성할지를 결정 하도록 하는 패턴. 스프링에서 빈을 컬렉션으로 주입할 수 있다. //타입 public enum AuthenticationType { PASSWORD, DEVICE, FIDO } //인터페이스 public interface AuthenticationService { AuthenticationType getAuthentiicationType(); void validateAuthentication(); } //비밀번호 인증구현체 @Slf4j @Service public class AuthenticationPasswordService implements AuthenticationService{ @Override public Authenticatio..