Announcement Announcement Module
Collapse
No announcement yet.
varying life cycle of services Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • varying life cycle of services

    As I understand,I can have varying lifecycle of services running with Spring. Like Service 1 needs to be running always, service 2 would be started on demand and shutdown after service.

    Correct me if I am wrong,
    cheers,
    -PandaSK

  • #2
    Service 1 should be a bean definition with singleton="true" (default anyway). The lifecycle of this object will be that of the BeanFactory that owns it.

    Service 2 should be a bean definition with singleton="false". Then every getBean() call will get a new instance, and the BeanFactory won't hold onto that instance.

    Comment

    Working...
    X