IoC
Factory Method pattern
Dependency Injection
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-factory-collaborators
생성자 기반 DI
설정자 기반 DI
클래스 내에서 적합한 기본값을 할당할 수 있는 경우에 사용해야
그렇지 않다면 null 체크 필수
디펜던시를 재구성하거나 재주입이 필요한 경우 유용
Spring팀에서는 생성자 기반 DI를 권장
Immutable 객체로 만들 수 있다
디펜던시가 null이 되는 것을 예방할 수 있다
완전히 초기화된 상태로 호출한 곳에 리턴된다
Bean Factory
ApplicationContext
Spring Core Docs
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans
References
https://www.youtube.com/watch?v=NZ_lPFvu9oU&t=2s&ab_channel=백기선