May 25th, 2012, 07:56 AM
Seting up spring in a multimodule application
Hi, I am working on a legacy web project that consist of multiple module. there is a spring context defined in the web module. I have another module which is just used as a library. Service type class is defined in this lib. I need to use DI within this lib module. What is the best way of doing this also, project is locked in with spring 2.5.6. Thanks in advance.
May 28th, 2012, 09:01 AM
could you please to be a bit more specific about what's the "service type class defined in this lib", and "use DI withing this lib module"?
I can't get the whole picture right now, but after understanding the problem, I could help you.
May 29th, 2012, 09:43 AM
Originally Posted by cmontemu
I will try my best here. Hopefully it clarify my question.
I have following modules:
1. Customer facing front end UI Module (Struts, Java Servlets)
2. Internal front end UI Module (Spring MVC)
3. Core Module (J2EE, used by both UI modules, Contains core services, DAO, etc. Has framework defined that can call "service classes" (i.e. service classes defined in other modules (some cases reflections is used to initialize and in others simple "new"))
4. Custom Services Module (J2EE, service classes are defined here that could be called from "Core Module", or Customer facing UI or even Spring MVC module, This service here could call other services within this module or others <<< This is where I wanted to configure Spring so that I could use DI)
In addition there are other modules but hopefully above clears the scenario. All these modules are deployed in single Tomcat container. Each of these modules use others as a "library" for instance in above scenario, "Custom Services Module" would be complied into a jar file that will be included as lib in front end UI modules.
May 29th, 2012, 01:54 PM
If you will be using Spring 3.0, then my suggestions would be Java based container configuration. Here you have an example I think is quite close to what you need.
But you're using an older Spring version, so you'll need to consult this forum in order to deal with it.
You can start from here and see whether what I told you above is good for you.
Hopefully somebody else can also give you more assistance.
May 29th, 2012, 02:44 PM
Tags for this Thread