@ primary1 의존관계 자동 주입 생성자 주입@Componentpublic class OrderServiceImpl implements OrderService{ private final MemberRepository memberRepository; private final DiscountPolicy discountPolicy; @Autowired // 생략 가능 public OrderServiceImpl(MemberRepository memberRepository, DiscountPolicy discountPolicy) { this.memberRepository = memberRepository; this.discountPolicy = discountPolicy; } ...}생성자.. 2024. 8. 29. 이전 1 다음