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.)
A.
This syntax is invalid because the result of the getBean() method call should be cast to ClientService.
B.
It will return a bean called ClientService regardless of its id or name.
C.
This syntax is invalid because the bean id must be specified as a method parameter.
D.
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
upvoted 4 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
quakquak3
2 months, 1 week agoAzuni
6 months, 2 weeks ago