PDA

View Full Version : when can the isSingleton() and isPrototype() methods both return false?



mukkipandy
Dec 30th, 2011, 12:18 PM
Hi I got this question in exam can any one please answer it ?

For a given Spring-managed bean, when can the isSingleton() and isPrototype() methods both return false?

options are
a>When only one request has been made for the bean
b>When a FactoryBean is being used to manage the bean
c>When a bean is configured for singleton, but an external reference is being held to the bean
d>When the bean is configured for lazy-loading and has not yet been initialized
e>When the bean's scope is "request"

Enrico Pizzi
Jan 13th, 2012, 02:20 AM
Well the answer is quite simple actually...when the bean in question is scoped neither as prototype nor as singleton, so it is a request, session or global session bean (or a bean with a user-defined custom scope). So the right answer is E.