Spring Bean Creation is Not Thread Safe
April 6, 2008
Post has been moved to our New Blog. http://blog.webscale.co.in/?p=64
Entry Filed under: Concurrency, Spring. .
4 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
KiLVaiDeN | April 7, 2008 at 1:20 pm
Interesting research and bug finding, surprising one.
This could lead to surprises and explain some undefined behaviors for some people so it’s good to point it out, and maybe you should fill some bug report on spring website in order to inform them asap about this problem.
I think lazy-init is not really needed though for singletons. Loading the beans at startup time is not a big cost and let’s you avoid a lot of problems.
K
2.
Adrian Colyer | April 8, 2008 at 8:14 am
I was about to raise an issue in the Spring JIRA to get this problem addressed, but found that someone has already beaten me to it:
http://jira.springframework.org/browse/SPR-4672
Thanks for the thorough investigation, we’ll make sure to get this bug addressed in the next release.
– Adrian.
3.
apnath | April 8, 2008 at 10:02 am
We have always been huge fans of spring, after creating the blog entry, Pavitar logged the bug mentioned in Adrian’s comment. There is a parallel discussion going in spring thread safety forum initiated by this thread at
http://forum.springframework.org/showthread.php?t=52236
The idea in the blog was to run through some thread safety issues and discuss gotchas that are possible even with a great framework like spring.
4.
rastogha | April 10, 2009 at 6:25 am
Good research and finding. I liked the post and appreciate the amount of depth you people went in.