2V0-72-22 practice question 11 of 15
Which two statements about the @Autowired annotation are true? (Choose two.)
Full set: 79 questionsThe @Autowired annotation can be applied to methods with multiple arguments, and the Spring container will attempt to resolve and inject a bean for each argument. By default, autowiring is required (required=true). If Spring cannot find a matching bean to inject for a required dependency, it will fail fast by throwing a NoSuchBeanDefinitionException (a RuntimeException) during the application context startup, preventing the application from running with an unsatisfied dependency.
A. @Autowired fields are injected during the "populate properties" phase, which is after bean instantiation but before initialization callbacks. The statement is imprecise about the lifecycle.
D. @Autowired is not a class-level annotation. It is used on constructors, fields, or methods to signal that a dependency should be injected.
E. Autowiring into BeanFactoryPostProcessor is not supported for regular beans, as they operate on bean definitions before any bean instances are created.
1. Spring Framework Documentation, 6.1.6. "Core Technologies", Section 1.4.5. "Annotation-based Container Configuration", Subsection "Autowired". States that @Autowired can be used on methods and that by default, the dependency is required.
2. Spring Framework Documentation, 6.1.6. "Core Technologies", Section 1.4.5. "Annotation-based Container Configuration", Subsection "Fine-tuning Annotation-based Autowiring with @Primary and @Qualifier". Mentions that if no matching bean is found for a required dependency, an exception is thrown.
3. Javadoc for org.springframework.beans.factory.annotation.Autowired. The required attribute documentation states it defaults to true, indicating the dependency is mandatory.
Keep practicing
Take the free 2V0-72-22 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 2V0-72-22 practice questions
- Question 1Which two statements describe Spring JdbcTemplate? (Choose two.)
- Question 2Which two options will inject the value of the daily.limit system property? (Choose two.)
- Question 3Which two statements are true regarding Spring and Spring Boot Testing? (Choose two.)
- Question 4Which two statements are correct regarding Spring Boot auto-configuration customization? …
- Question 5Which two statements are true about @Controller annotated classes? (Choose two.)
- Question 6Which statement is true? (Choose the best
