MicroSpring |
| Home |
The Spring IOC Guide in a single sheet of paper! Either print this off, or download the PDF version.
| All you need to know! (for the average user, on green field project ) Source: C:\<install dir>\spring-framework-1.1.3\docs\reference\html_single\index.html |
| Note from the author. I only use Spring for IOC, not for AOP, not for DAO, not for JDBC rewrite, not for Web, or every other part of my system. I have a JVM and an OS, I do not need yet another J2EE. This is my personal choice, and one I am extremely happy with. |
|
Client Code:
FileSystemXmlApplicationContext factory = new XmlBeanFactory("config.xml"); |
=======
Client Code:
FileSystemXmlApplicationContext factory = new FileSystemXmlApplicationContext("config.xml"); |
>>>>>>> .r28
BeanFactory methods:
boolean containsBean(String)
Object getBean(String)throws BeansException;
Object getBean(String,Class) throws BeansException;
boolean isSingleton(String) throws NoSuchBeanDefinitionException
Class getType(String name) throws NoSuchBeanDefinitionException;
String[] getAliases(String)throws NoSuchBeanDefinitionException;
|
Null param value null = <property name="email"><null/></property> The list, set, map, and props elements allow properties and arguments of Java type List, Set, Map, and Properties, respectively, to be defined and set. |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- example of list and map and idref and property values -->
<bean id="cityFinder" class="com.tallsoft.springeg.CityScape" singleton="true">
<property name="cityMap">
<map>
<entry key="LDN"><value>London</value></entry>
<entry key="FFT"><value>Frankfurt</value></entry>
</map>
</property>
</bean>
<!-- example of list and depends on for creation ordering-->
<bean id="region" class="com.tallsoft.springeg.RegionInfo" depends-on="cityFinder">
<property name="cityFinder"><ref bean="cityFinder"/></property>
<property name="regions">
<list>
<value>Europe</value>
<value>America</value>
</list>
</property>
</bean>
<!-- example of template, and the init method -->
<bean id="templateGeography" abstract="true"
class="com.tallsoftware.springeg.BaseGeography">
<property name="planetName"><value>Earth</value></property>
<property name="system"><value>sol</value></property>
</bean>
<bean id="earth" class="com.tallsoft.springeg.PlanetInfo"
parent="templateGeography" />
<bean id="mars" class="com.tallsoft.springeg.PlanetInfo"
parent="templateGeography" init-method="initialize">
<!-- overriding the value here -->
<property name="planetName"><value>Mars</value></property>
</bean>
</beans>
|