의존 객체 주입 패턴 public SpellChecker { private static final Lexicon dictionary = new NaverLexicon(); } 이런 맞춤법 검사기가 있는 경우 DaumLexicon을 사용하거나 특수한 어휘사전을 사용할 수 없습니다. public SpellChecker { private static final Lexicon dictionary; public SpeelChecker(Lexicon dictionary) { dictionary = Objects.requireNonNull(dictionary); } } 위의 코드와 같이 생성자에 필요한 자원을 넘겨주는 방식을 사용하면 클리아이언트가 원하는 어휘사전을 사용할 수 있습니다. 이런 의존 객체 주입 패턴은 ..