<dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.3.8.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.3.8.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.3.8.RELEASE</version> </dependency>
暂时先不考虑express language模块。
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="myTestBean" class="chapter02.MyTestBean"/> </beans>
BeanFactory bf = new XmlBeanFactory(new ClassPathResource("beanFactoryTest.xml"));
注:beanFactoryTest.xml指上述xml文件;chapter02.MyTestBean是一个简单的bean(包含一个私有属性,get,set方法)
<bean id="test" class="test.Myclass"> <mybean:user username="aaa"/> </bean>
需要用到delegate.decorateBeanDefinitionIfRequired();进行自定义标签的处理,处理过程如下:
原文:http://www.cnblogs.com/angluil/p/7756868.html