This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

FactoryBean's isSingleton()

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everybody,

By returning true from isSingleton() method of FactoryBean implementation class,

Does Spring create a Singleton instance of the Class Implementing the FactoryBean Interface


If yes, then the following code



does not throw an exception even when the Implementing class has explicitly defined itself as a singleton through scope="prototype" and isSingleton() method returns true.

Thanks In Advance,
Pramod
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Returning true in isSingleton() will not magically make your bean a singleton. You have to make it work like a singleton, so you have to make sure that getObject() always returns the same object (a reference that can be cached). Is there any special reason why you are using this interface ?
 
Arya Pramod
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Christophe,

I am actually new to Spring Framework, so just getting some hands-on knowledge.
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic