Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spring] DI 하는 경우에 생성자 주입과 필드 주입의 차이가 무엇인지? #23

Open
SeokRae opened this issue Apr 13, 2022 · 1 comment

Comments

@SeokRae
Copy link
Collaborator

SeokRae commented Apr 13, 2022

No description provided.

@SeokRae SeokRae changed the title [Spring] DI 하는 경우에 생성자 주입과 Autowired의 차이가 무엇인지? [Spring] DI 하는 경우에 생성자 주입과 필드 주입의 차이가 무엇인지? Apr 13, 2022
@kkj0419
Copy link
Collaborator

kkj0419 commented May 11, 2022

대표적으로는
생성자 주입에 대해서는 필드�를 final로 선언을하여 나중에 수정되지 못하게 할 수 있지만,
필드 주입에 대해서는 final 선언이 불가능하여 나중에 변경될 가능성이 있다는 차이점이 생각납니다
이런 특징 때문에 Spring 공식에서는 생성자 주입을 권장하고 있다고 알고 있습니다 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants