通过@Autowierd进行toType装配,该配置的配置了,但是总是TestA里面的TestB属性无法通过自动注入的方式实例化,求解???
package com;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
public class SpringTest 
{
/**
 * @param args
 */
public static void main(String[] args) 
{
// TODO Auto-generated method stub
/* 加载配置文件 */
Resource resource = new ClassPathResource("applicationContext.xml");

/* 初始化Ioc 容器 */
BeanFactory bean = new XmlBeanFactory(resource);
TestA t = (TestA) bean.getBean("testA");
System.out.println(t.testB == null);
}
}package com;import javax.annotation.Resource;import org.springframework.beans.factory.annotation.Autowired;public class TestA {
@Autowired
public TestB testB;
}class TestB {
private String name; public String getName() {
return name;
} public void setName(String name) {
this.name = name;
}
}<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
<bean id="testA" class="com.TestA" />
<bean id="testB" class="com.TestB">
<property name="name" value="admin" />
</bean>
</beans>