标签:ring location comm actor 执行 this sch get 上下文
package com.yiibai.common; import org.springframework.beans.factory.annotation.Required; public class Customer { private Person person; private int type; private String action; public Person getPerson() { return person; } @Required public void setPerson(Person person) { this.person = person; } }
<beans ... xmlns:context="http://www.springframework.org/schema/context" ... http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> ... <context:annotation-config /> ... </beans>
完整的实例,
<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-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <context:annotation-config /> <bean id="CustomerBean" class="com.yiibai.common.Customer"> <property name="action" value="buy" /> <property name="type" value="1" /> </bean> <bean id="PersonBean" class="com.yiibai.common.Person"> <property name="name" value="yiibai" /> <property name="address" value="address ABC" /> <property name="age" value="29" /> </bean> </beans>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/> <bean id="CustomerBean" class="com.yiibai.common.Customer"> <property name="action" value="buy" /> <property name="type" value="1" /> </bean> <bean id="PersonBean" class="com.yiibai.common.Person"> <property name="name" value="yiibai" /> <property name="address" value="address ABC" /> <property name="age" value="29" /> </bean> </beans>
org.springframework.beans.factory.BeanInitializationException: Property ‘person‘ is required for bean ‘CustomerBean‘
标签:ring location comm actor 执行 this sch get 上下文
原文地址:http://www.cnblogs.com/soundcode/p/6367403.html