-
Jan 11th, 2011, 09:38 AM
#1
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.
-
Jan 12th, 2011, 12:31 PM
#2
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.
-
Jan 12th, 2011, 02:44 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules