I\'m having an issue with pulling a Spring bean from an application context.
When I try;
InnerThread instance = (InnerThread) SpringContextFactory.g
Once again, after spending hours trying to debug this I find the answer right after posting on StackOverflow.
A key point that I left out from my question is that InnerThread has a transactional method (sorry thought this was irrelevant). This is the important difference between OuterThread and InnerThread.
From the Spring documentation:
Note
Multiple sections are collapsed into a single unified auto-proxy creator at runtime, which applies the strongest proxy settings that any of the sections (typically from different XML bean definition files) specified. This also applies to the and elements.
To be clear: using 'proxy-target-class="true"' on , or elements will force the use of CGLIB proxies for all three of them.
Adding the above to my configuration (based in persistance-context.xml, which you can see loaded above) line seems to fix the problem. However, I think this may be a quick fix workaround as opposed to real solution.
I think I've got a few deeper issues here, number one being that I find Spring as confusing as expletive deleted. Second I should probably be using Spring's TaskExecutor to kick off my threads. Third my threads should implement Runnable instead of extending Thread (See SO question below).
See Also