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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have a couple of options:
Import
Include in the
ApplicationContextConstructionMake both files a part of your
ApplicationContextwhen you create it => then no import is needed.For example if you need it during testing:
In case it is a web app, you’d do it in
web.xml:If it is a stand alone app, library, etc.. you would load your
ApplicationContextas: