This is true because the Locale argument can be used to resolve the current locale that the client is using, based on the Accept-Language header or a cookie1.
B. Principal
This is true because the Principal argument can be used to access the currently authenticated user, if any1.
F. HttpSession
This is true because the HttpSession argument can be used to access the current session, if any1. Note that this argument is not required and will be null if a session does not exist.
Based on the default Spring behavior, choose the correct answer. (Choose the best answer.)
Options:
A.
One AccountRepository bean will be instantiated since the default scope is singleton.
B.
Three AccountRepository beans will be instantiated as the accountRepository() method will be called three times.
C.
Many AccountRepository beans will be instantiated, depending how often accountRepository(), transferService() and accountService() are called.
D.
Two AccountRepository beans will be instantiated as the accountRepository() method will be called two times.
Answer:
A
Explanation:
This is true because the default scope of a bean in Spring is singleton, which means that only one instance of the bean will be created and shared by the entire application context. The @Bean annotation on the accountRepository() method indicates that this method will return a bean that will be managed by Spring. However, this method will not be called every time the bean is needed, but only once when the bean is first created. Therefore, only one AccountRepository bean will be instantiated and injected into the TransferService and AccountService beans.
Question 3
Which two statements are true about REST? (Choose two.)