Which two statements about the @Autowired annotation are true? (Choose two.)
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.
Answer: BC
Explanation:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html
B. Multiple arguments can be injected into a single method using @Autowired.
This is true because the @Autowired annotation can be applied to methods with arbitrary names and multiple arguments, as shown in the example in Using @Autowired.
C. By default, if a dependency cannot be satisfied with @Autowired, Spring throws a RuntimeException.
This is true because the @Autowired annotation has a required attribute that is true by default, meaning that the dependency is mandatory. If Spring cannot find a matching bean to inject, it will throw a BeanCreationException, which is a subclass of RuntimeException. To avoid this exception, we can set the required attribute to false, which will allow Spring to skip the injection if no matching bean is found
Latest 2V0-72.22 Dumps Valid Version with 60 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund