I have some mock DAOs that I created for some JUnits. I have them autowired with a separate application context file. (They are in a different package and I'm using the component scan) They just return dummy objects instead of fetching from the database. The regular DAOs are through hibernate.
My problem is, I can't figure out how to tell Spring to use that file when running JUnits, and to use the regular XML file otherwise. I want the JUnits to run with the mock DAOs, so we don't need a DB for those. But then when running the application normally, use the real DAOs.
I am fairly new to Spring so this is all a learning experience for me. Any help would be appreciated. Thanks.
One other thing -- I have them in a separate file because they are the same names as the regular DAOs, so that nothing else has to change. But if there is a way to tell Spring to only load the mock ones, or to only use the mock ones for JUnit, then I don't need the separate file.