public class Constructor { private Sample sample; // 생성자 주입 public Constructor(Sample sample) { this.sample = sample; } }
public class Setter { private Sample sample; // Setter 주입 public void setSample(Sample sample) { this.sample = sample; } }
public class Printer { // 메서드 주입 public void printDocument(Document document, InkCartridge ink) { // 인쇄 로직 } }