Problem Description: If the spring bean is distributed in a different XML file, the workaround for others (I tried, seemingly not) should be referred to as follows: such as the bean defined in A.xml
<bean id= "Generaldao" class= "Generaldao" ></bean> a.xml files
File B.xml apply A.xml Bean
<bean id= "Bookserviceclassa" class= "Webserviceimpla" scope= "prototype" autowire= "ByName" > <property "name=" Generaldao "> <ref local=" Generaldao "/> </property> </bean>
Where Generaldao is defined in A.xml
My own solution.
Applicationcontext.xml file
<bean id= "Pubusersdao" class= "Com.laj.security.dao.PubUsersDAO" ><property name= "Sessionfactory" >< Ref bean= "Sessionfactory"/></property></bean>
Referencing the Pubuserdao in the Applicationcontext.xml file in the Applicationcontext-security.xml file
<beans:bean id= "Userdetailsservice" class= "Com.laj.security.service.MyUserDetailsService" >
<beans: Property name= "Pubusersdao" >
<beans:ref bean= "Pubusersdao"/>
</beans:property>
</ Beans:bean>
I am close to test, easy to use