<?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>Java豆技术站点 &#187; beanfactory</title>
	<atom:link href="http://javadou.com/tag/beanfactory/feed/" rel="self" type="application/rss+xml" />
	<link>http://javadou.com</link>
	<description>Java</description>
	<lastBuildDate>Thu, 12 Aug 2010 09:01:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Spring BeanFactory 简单模仿帮助大家理解</title>
		<link>http://javadou.com/spring-beanfactory-lijie-243/</link>
		<comments>http://javadou.com/spring-beanfactory-lijie-243/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:48:00 +0000</pubDate>
		<dc:creator>阿超</dc:creator>
				<category><![CDATA[Spring]]></category>
		<category><![CDATA[beanfactory]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://javadou.com/spring-beanfactory-lijie-243/</guid>
		<description><![CDATA[Spring 是什么, 就是个大 Map. import java.io.InputStream; import java.util.Enumeration; import java.util.Hashtable; import java.util.Map; import java.util.Properties; public class BeanFactory { private static Map&60;String, Object&62; objectPool = new Hashtable&60;String, Ob... ]]></description>
			<content:encoded><![CDATA[<p>Spring 是什么, 就是个大 Map.</p>
<pre class="java">import java.io.InputStream;

import java.util.Enumeration;

import java.util.Hashtable;

import java.util.Map;

import java.util.Properties;

public class BeanFactory {

private static Map&lt;String, Object&gt; objectPool = new Hashtable&lt;String, Object&gt;();

static {

Properties config = new Properties();

InputStream in = BeanFactory.class

.getResourceAsStream(&quot;beans-config.properties&quot;);

if (in == null) {

throw new ExceptionInInitializerError(

&quot;no file:beans-config found error!&quot;);

}

try {

config.load(in);

in.close();

Enumeration ids = config.propertyNames();

while (ids.hasMoreElements()) {

String id = (String) ids.nextElement();

String className = config.getProperty(id);

Object instance = Class.forName(className).newInstance();

objectPool.put(id, instance);

}

} catch (Exception e) {

e.printStackTrace();

throw new ExceptionInInitializerError(&quot;failed to init bean pools!&quot;);

}

}

public static Object getBean(String id) {

return objectPool.get(id);

}

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://javadou.com/spring-beanfactory-lijie-243/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
