@Autowired
MemberRepository memberRepository = new MemberRepository();
private final MemberRepository memberRepository;
@Autowired
public void setMemberRepository(MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}
private final MemberRepository memberRepository;
@Autowired
public MemberService(MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}
@RequiredArgsConstructor
❕ 스프링부트의 경우
@PersistenceContext
⇒ @Autowired
대체 가능하다@RequiredArgsConstructor
를 사용가능