how to reference a bean of another xml file in spring

前端 未结 6 1349
花落未央
花落未央 2020-12-07 17:30

I have a Spring bean defined in an xml file. I want to reference it from another xml file. How can I go about it?

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 18:26

    Just import the xml defining the bean with and you will be able to use the bean definition.

    You can use classpath: in the resource attribute:

    
    

    See the "3.18. Importing Bean Definitions from One File Into Another" in this chapter of the Spring Reference

提交回复
热议问题