Always prompt for errors when writing to a spring applicationcontext.xml
<bean id= "service" class= "service. Serviceimpl ">
<property name=" DAO ">
<ref local=" dao "/> <!--here Prompt local property error-
</property>
</bean>
Error hint:cvc-complex-type.3.2.2:attribute ' local ' is not allowed to appear in element ' ref '.
Wonder, other people with spring3.x jar package So write no problem, I use the spring4.x version does not support this way of writing.
After searching, find this similar post:
After seeing the reply of the great gods below, we conclude that the solution is divided into two kinds:
1, the ref child tag as one of the properties of the property parent tag, the property value is the value of the original local property
<property name= "DataSource" >
<ref local= "DataSource"/>
</property>
change to below
try <property name= "DataSource" ref= "DataSource"/>
2. Change the local property to the Bean attribute
<bean id= "service" class= "service. Serviceimpl ">
<property name=" DAO ">
<ref bean=" dao "/>
</property>
</ Bean>
This way, it is estimated that the new spring version has removed this