Announcement Announcement Module
Collapse
No announcement yet.
Performance of beanFactory.getBean() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Performance of beanFactory.getBean()

    I assume that the performance of beanFactory.getBean("someSingleton") is lightning fast-- essentially no worse than map.get("someSingleton"). Is that true?

  • #2
    Maybe, maybe not. It depends on the bean you ask for. If it's lazy-init attribute is true or if it is a prototype bean then Spring will have to create an instance of the bean. How long it takes to do that is completely dependant on what the constructor and init method of the bean itself does so its like asking "How long is a length of rope?", there is no real answer....

    However, if it is a singleton with lazy-init being false, I would assume it should be pretty fast.....

    Comment


    • #3
      I am assuming a singleton with lazy-init false.

      Comment

      Working...
      X