Item 5. Dependency Injection
// 1. μ μ μ νΈλ¦¬ν° ν΄λμ€
class SpellChecker {
private final Lexicon dictionary = new KoreanDictionary();
private SpellChecker() {
}
// ...
}// 2. μ±κΈν΄
class SpellChecker {
public static final SpellChecker INSTANCE = new SpellChecker();
private final Lexicon dictionary = new KoreanDictionary();
private SpellChecker() {
}
// ...
}μμ‘΄ κ°μ²΄ μ£Όμ
Last updated