VMware vRealize Automation 8.x (2022) — Question 5
Which two statements about the @Autowired annotation are true? (Choose two.)
Answer options
- A. @Autowired fields are injected after any config methods are invoked.
- B. Multiple arguments can be injected into a single method using @Autowired.
- C. By default, if a dependency cannot be satisfied with @Autowired, Spring throws a RuntimeException.
- D. If @Autowired is used on a class, field injection is automatically performed for all dependencies.
- E. @Autowired can be used to inject references into BeanPostProcessor and BeanFactoryPostProcessor.
Correct answer: B, C
Explanation
Option B is correct because @Autowired allows multiple parameters in a method to be injected. Option C is also accurate, as Spring throws a RuntimeException by default if it cannot satisfy a dependency. The other options are incorrect as they either misrepresent the injection process or the behavior of @Autowired.