-
Dec 28th, 2009, 08:25 AM
#1
singletons in Spring context and MessageDrivenContext
i have a webapp that uses mdb's and is deployed to an ear. in my spring context i have some beans defined as singletons.
everything works fine, just one thing puzzles me - i inserted a breakpoint in a constructor of a class, that is supposed to be a singleton (in terms of a spring bean).
the breakpoint worked when context was loading - this is what i expected - and then between calls to setMessageDrivenContext and onMessage.
how come? why is the context built more than once? can't the MessageDrivenContext share beans with Spring? that looks to be an efficiency hit, creating all the beans all over again for each MDB. as i see, this happens only when an mdb is initiated, but still, what if one has many MDBs?
-
Dec 28th, 2009, 12:21 PM
#2
I suspect either something wrong with your configuration or usage of spring inside MDB. Also make sure the jars needed are located on the correct level (a singleton is a singleton per classloader NOT per VM).
-
Dec 29th, 2009, 02:47 AM
#3
ok, now i get it (classloader vs VM).
thx!
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