강의

멘토링

커뮤니티

Inflearn Community Q&A

concotree8563's profile image
concotree8563

asked

Introduction to Spring Framework

Dependency Injection

왜 생성자에 @Autowired를 붙이는지 모르겠습니다.

Written on

·

391

0

생성자에 @Autowired를 붙여 의존성을 주입하고 그것이 생략 가능하다고 하셨는데, 생성자에서 파라미터로 정의된 빈은 ApplicationContext에서 인자로 넘겨주는 걸로 들었습니다.

그렇다면 인자로 주어지는데 왜 @Autowired를 통해서 또 주입을 받아야하는건지 잘 모르겠습니다.

제 질문지 맞는 질문인지도 잘 모르겠네요...

javaspring

Answer 1

0

whiteship님의 프로필 이미지
whiteship
Instructor

다양한 방법이 있다고 보여드린거 뿐이지 여러 방법 중에 하나만 쓰시면 됩니다.

concotree8563's profile image
concotree8563

asked

Ask a question