VMware vRealize Automation 8.x (2022) — Question 3

Which two statements are true concerning constructor injection? (Choose two.)

Answer options

Correct answer: A, C

Explanation

The correct answer, A, is accurate because when there is only one constructor in a class, Spring automatically uses it for dependency injection, making @Autowired unnecessary. Option C is also correct as constructor injection allows for easier testing through the provision of dependencies directly. Options B, D, and E are incorrect because constructor injection can handle multiple values through multiple parameters, it does require @Autowired for multiple constructors, and field injection is generally considered less favorable for unit testing due to tight coupling.