July 5, 2023
Which of the following options are true?
Using field injection has the following results:
* safer code
* more complicated to test
* less code to write
* easy to test
#spring #certificationquestion #vcp
Answer: more complicated to test, unsafe, but less code to write.
Field injection:
++ less code to write
-- unsafe code
- more complicated to test
Constructor injection:
++ safe code
- more code to write (see the hint to Lombok)
+ easy to test
Details👉https://lnkd.in/epftbtA7 (Why field injection is evil?
by Java Champion Oliver Drotbohm)