May 28th, 2006, 05:24 AM
Dependencies in applicationContext
We have a large project where we have POJO'ed most of our existing ejbs. The ones we have not fully POJO'ed are our stateless session beans acting as facade entry points for third party (other project) access i.e. where other projects accesses our functionality via JNDI lookup to our Remote EJB's and even here we have POJO'ed the business logic to enable better testing and they all extend the AbstractStatelessSessionBean.
In doing this we have created a couple of application context xml files that inject dependencies into these POJO's. All singleton beans have been set to lazy-init=true.
We also want to use these context files within our web applications as well as well as our non J2EE clients. The web applications use a subset of the beans defined in the contexts. The problem now comes that even with lazy-init=true (i.e. I only want to instanciate a bean if its used) all jar files required to satisfy even the unused beans (i.e. ones that will NEVER be used within this web application listed in the loaded context files) are needed on the class path. This has bloated our deployment and has meant that each of our maven projects now require dependencies on other projects or jar files they will never use.
We have kept the context files course like this with the intention that they go into one project which contains only the xml context files and the resultin jar file is included in all projects using any context. All these individual context files are then accessed either with the singleton classpath*:breanRefFactory approach (listing each individual context) within ejb projects or with a webRefFactory.xml that just uses the import element to import all other context files and keep things simple for project members getting used to Spring.
So we now have a situation that ALL our individual maven projects (enabling fine grained deployment of our application) depend on ALL other maven projects bloating all individual deployments and introducing non dependend dependencies.
Can anybody recomend the best way to resolve this issue.