Results 1 to 3 of 3

Thread: Question about prototype scope bean

  1. #1

    Default Question about prototype scope bean

    If I inject a singleton datasource to a prototype scope bean, do I need to add a post-processor for the prototype bean to destroy/release the datasource?

    If I don't, will the datasource be hold by the prototype bean forever (till the application is shut down)?

    Thanks in advance.

  2. #2

    Default

    If the prototype bean lives for the life of the application then the datasource be referenced by it. However, if the prototype bean is tied to a thread then it will be destroyed when the thread ends. Usually a datasource bean is thread-safe. This means that there is nothing wrong with multiple prototype beans having a reference to the datasource bean. I hope this helps.

  3. #3

    Default

    Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •