- org.springframework.context-3.1.0.M2.jar
- org.springframework.beans-3.1.0.M2.jar
- dist\org.springframework.core-3.1.0.M2.jar
- commons-logging-1.1.1.jar
- dist\org.springframework.asm-3.1.0.M2.jar
- dist\org.springframework.expression-3.1.0.M2.jar
- commons-beanutils-1.8.0.jar
- dom4j
- Introspector java.beans.Introspector
- ConvertUtils.convert("1232a", Integer.class); org.apache.commons.beanutils.ConvertUtils
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<!-- for annotation should quote the three line above and a line below -->
<context:annotation-config/>
<!-- id can not been named as special character ,but name does -->
<!-- 1. normal instance of bean-->
<bean id="personService" class="beans.PersonServiceBean">
<property name="personDao" ref="personDao"></property>
<property name="testName" value="James"/>
<property name="sets">
<set>
<value>a</value>
<value>b</value>
<value>c</value>
</set>
</property>
<property name="lists">
<list>
<value>a</value>
<value>b</value>
<value>c</value>
<bean class="interfaces.PersonServiceFactory" />
<bean class="beans.PersonDaoBean"/>
</list>
</property>
<property name="maps">
<map>
<entry key="3" value="personDao"/>
<entry key="1" value-ref="personDao"/>
<entry key="2" value-ref="personDao"/>
</map>
</property>
<property name="properties">
<props>
<prop key="age">11</prop>
</props>
</property>
</bean>
<bean id="personDao" class="beans.PersonDaoBean">
</bean>
<!-- 2. static factory instance of bean-->
<bean id="personService2" class="interfaces.PersonServiceFactory" factory-method="createFactory"/>
<!-- 3. factory instance of bean-->
<bean id="personServiceFactory" class="interfaces.PersonServiceFactory"/>
<bean id="personService3" factory-bean="personServiceFactory" factory-method="createFactory2"/>
<!-- <bean id="personService3" factory-bean="personServiceFactory" factory-method="createFactory2" scope="prototype"/> -->
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<!-- FOR AUTO INJECT IN CLASS FILES -->
<context:component-scan base-package="beans"/>
</beans>
- differences between Reflect and Introspector
- Automatically detecting classes and registering bean definitions
@Service @Repository @Controller
@Scope .....
double checked lock
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
Spring框架配置与依赖注入
本文介绍了Spring框架的配置方式及依赖注入的多种实现方法,包括普通实例化、静态工厂实例化和工厂实例化等,并探讨了注解自动扫描、反射与内省的区别以及双重检查锁定模式。

被折叠的 条评论
为什么被折叠?



