<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>indiWiz.com &#187; IoC</title>
	<atom:link href="http://indiwiz.com/tag/ioc/feed/" rel="self" type="application/rss+xml" />
	<link>http://indiwiz.com</link>
	<description>Subhash&#039;s Tech Log</description>
	<lastBuildDate>Wed, 03 Mar 2010 13:24:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Implementing a DI Framework for WizTools.org RESTClient</title>
		<link>http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/</link>
		<comments>http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 16:34:44 +0000</pubDate>
		<dc:creator>Subhash Chandran</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[restclient]]></category>

		<guid isPermaLink="false">http://indiwiz.com/?p=83</guid>
		<description><![CDATA[I wanted very basic DI functionality for RESTClient. Just wanted a mock implementation to execute when doing a mvn test, and real implementation when executed otherwise. So the functionality was simple. My immediate requirement did not require constructor injection or setter injection. And all the beans instantiated had to be singletons. No other fancy requirement. [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted very basic DI functionality for <a href="http://rest-client.googlecode.com/">RESTClient</a>. Just wanted a mock implementation to execute when doing a <tt>mvn test</tt>, and real implementation when executed otherwise. So the functionality was simple. My immediate requirement did not require constructor injection or setter injection. And all the beans instantiated had to be singletons. No other fancy requirement. So for this limited functionality, I was able to design a small framework in two classes: <a href="http://code.google.com/p/rest-client/source/browse/trunk/src/main/java/org/wiztools/restclient/di/DIFramework.java">DIFramework.java</a> and <a href="http://code.google.com/p/rest-client/source/browse/trunk/src/main/java/org/wiztools/restclient/di/DIException.java">DIException.java</a>. For mapping the implementation to the interface, it is managed using a simple property file with content:</p>
<table border="1" width="100%" cellpadding="5" cellspacing="1">
<tr>
<td>
<pre>
org.wiztools.restclient.IGlobalOptions = org.wiztools.restclient.GlobalOptions
</pre>
</td>
</tr>
</table>
<p></p>
<p>The mock implementation in the test execution would be:</p>
<table border="1" width="100%" cellpadding="5" cellspacing="1">
<tr>
<td>
<pre>
org.wiztools.restclient.IGlobalOptions = org.wiztools.restclient.MockGlobalOptions
</pre>
</td>
</tr>
</table>
<p></p>
<p><tt>org.wiztools.restclient.IGlobalOptions</tt> is the interface, and <tt>org.wiztools.restclient.GlobalOptions</tt> and <tt>org.wiztools.restclient.MockGlobalOptions</tt> are the implementation. To get instance of implementation bean:</p>
<pre class="brush: java;">
IGlobalOptions obj = DIFramework.getInstance(IGlobalOptions.class);
</pre>
<p>This would return two different beans in different execution environments based on the property control.</p>


<div class="shr-bookmarks shr-bookmarks-expand">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;title=Implementing+a+DI+Framework+for+WizTools.org+RESTClient" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;title=Implementing+a+DI+Framework+for+WizTools.org+RESTClient" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;title=Implementing+a+DI+Framework+for+WizTools.org+RESTClient&amp;desc=I%20wanted%20very%20basic%20DI%20functionality%20for%20RESTClient.%20Just%20wanted%20a%20mock%20implementation%20to%20execute%20when%20doing%20a%20mvn%20test%2C%20and%20real%20implementation%20when%20executed%20otherwise.%20So%20the%20functionality%20was%20simple.%20My%20immediate%20requirement%20did%20not%20require%20constructor%20injection%20or%20setter%20injection.%20And%20all%20the%20b" rel="nofollow" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;t=Implementing+a+DI+Framework+for+WizTools.org+RESTClient" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;title=Implementing+a+DI+Framework+for+WizTools.org+RESTClient&amp;summary=I%20wanted%20very%20basic%20DI%20functionality%20for%20RESTClient.%20Just%20wanted%20a%20mock%20implementation%20to%20execute%20when%20doing%20a%20mvn%20test%2C%20and%20real%20implementation%20when%20executed%20otherwise.%20So%20the%20functionality%20was%20simple.%20My%20immediate%20requirement%20did%20not%20require%20constructor%20injection%20or%20setter%20injection.%20And%20all%20the%20b&amp;source=indiWiz.com" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/&amp;title=Implementing+a+DI+Framework+for+WizTools.org+RESTClient" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://indiwiz.com/2008/12/15/implementing-a-di-framework-for-wiztoolsorg-restclient/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DI: Annotation or XML Configuration</title>
		<link>http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/</link>
		<comments>http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 15:41:30 +0000</pubDate>
		<dc:creator>Subhash Chandran</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[IoC]]></category>

		<guid isPermaLink="false">http://indiwiz.com/?p=80</guid>
		<description><![CDATA[Recently I have been looking at couple of DI containers in Java. These are: Google Guice and Spring Framework. I did not like Guice in the first look itself. It involved annotating my beans with Guice specific annotations. I felt this was defeating the purpose of POJO. XML configuration using Spring was more natural for [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been looking at couple of DI containers in Java. These are: <a href="http://code.google.com/p/google-guice/">Google Guice</a> and <a href="http://www.springframework.org/">Spring Framework</a>. I did not like Guice in the first look itself. It involved annotating my beans with Guice specific annotations. I felt this was defeating the purpose of POJO. XML configuration using Spring was more natural for me.</p>


<div class="shr-bookmarks shr-bookmarks-expand">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;title=DI%3A+Annotation+or+XML+Configuration" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;title=DI%3A+Annotation+or+XML+Configuration" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;title=DI%3A+Annotation+or+XML+Configuration&amp;desc=Recently%20I%20have%20been%20looking%20at%20couple%20of%20DI%20containers%20in%20Java.%20These%20are%3A%20Google%20Guice%20and%20Spring%20Framework.%20I%20did%20not%20like%20Guice%20in%20the%20first%20look%20itself.%20It%20involved%20annotating%20my%20beans%20with%20Guice%20specific%20annotations.%20I%20felt%20this%20was%20defeating%20the%20purpose%20of%20POJO.%20XML%20configuration%20using%20Spring" rel="nofollow" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;t=DI%3A+Annotation+or+XML+Configuration" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;title=DI%3A+Annotation+or+XML+Configuration&amp;summary=Recently%20I%20have%20been%20looking%20at%20couple%20of%20DI%20containers%20in%20Java.%20These%20are%3A%20Google%20Guice%20and%20Spring%20Framework.%20I%20did%20not%20like%20Guice%20in%20the%20first%20look%20itself.%20It%20involved%20annotating%20my%20beans%20with%20Guice%20specific%20annotations.%20I%20felt%20this%20was%20defeating%20the%20purpose%20of%20POJO.%20XML%20configuration%20using%20Spring&amp;source=indiWiz.com" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/&amp;title=DI%3A+Annotation+or+XML+Configuration" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://indiwiz.com/2008/12/15/di_annotation_or_xml_conf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
