Refer to the exhibit.
It is a Java code fragment from a Spring application. Which statement is true with regard to the above example? (Choose the best answer.)
Refer to the exhibit.
It is a Java code fragment from a Spring application. Which statement is true with regard to the above example? (Choose the best answer.)
The method applicationContext.getBean(ClientService.class) is used to retrieve a bean from the Spring application context based on its type. Therefore, it will return a bean of the type ClientService regardless of its id or name.
The answer is correct. Just remember though that you can fetch it with bean name, class or both (which was a surprise to me). https://www.baeldung.com/spring-getbean#3-retrieving-bean-by-type