we have quite a few projects that use the same codebase (backend code). Just the frontend tends to be different. We decided that the best approach would be to seperate backend and frontend into different projects: Engine and Project_name
Now these are Spring-projects. So it would only seem logical if we divide the Spring configurations aswell: Database.xml, Services.xml would belong to the project Engine. And a specific Frontend.xml would belong to Project_Name. To link these up, I would need a generic SpringBeans.xml that imports all of these XML's.
I tried following directory structure:
Engine Project
Project_Name Project
The contents of SpringBeans.xml are simply:
<import resource="spring/Database.xml"/>
<import resource="spring/Services.xml"/>
<import resource="spring/Frontend.xml"/>
I set up Eclipse so the Project_Name project references the Engine project. When I start it, SpringBeans.xml gets found, however the XML files in the Engine project aren't found (FileNotFoundException). I'll also note that before splitting up the Engine and Frontend code into different projects, the principle of importing other XML files worked like a charm.
So my question to you: Is it possible to make different Spring configrations in different projects play together nicely?
Since the spring bean configuration files are in the classpath, you need to add the prefix claspath to the resource location:
<import resource="classpath:spring/Database.xml"/> <import resource="classpath:spring/Services.xml"/> <import resource="classpath:spring/Frontend.xml"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With