This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Application Frameworks and the fly likes Spring Question: How to realize IOC in stand alone programs? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring Question: How to realize IOC in stand alone programs?" Watch "Spring Question: How to realize IOC in stand alone programs?" New topic
Author

Spring Question: How to realize IOC in stand alone programs?

Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
I have a stand alone program that loads application context and then fetches the jdbctemplate using datasource defined in the context file in the main program.

I do have other DAO classes defined in the application context, but when they are called i am not able to get access to the Jdbctemplate, unless i pass it into them.

Here is my example config for the DAO does say it is 'datasource' driven:
<bean id="requestData" class="com.x.y.z.dao.RequestDAO">
<property name="dataSource" ref="dataSource" />
</bean>

Do i need to make the DAOs applicationcontext aware or something similar??
[ August 14, 2008: Message edited by: Kishore Dandu ]

Kishore
SCJP, blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Question: How to realize IOC in stand alone programs?