We have multiple products. For simplicity, let's call them an orders system ("orders") and a billing system ("billing"). Customers may buy 1 or more of our products. No product must require another product to exist in order to function but the products are built such that if another of our products exist, the products will use the other. For example, if orders sees that there is a billing system (i.e. has a non-null billing services injected into it), each order will create a bill. Likewise, if the billing system sees that there is an orders system, non-payment will cause the cancellation of outstanding orders.
Each product is packaged as an ear but, if needed, I can merge them into one master ear containing each of the purchased product wars. Target platforms are Websphere 6.1 to start with JBoss and others in the future.
How to configure this in Spring? What I think I want is one global, singleton context where all definitions are merged. That way, I can inject (or look up if needed) orders sevices into billing services and vise versa. This would also allow me to share some common configuration. The trick is how to set this up?
I have a ContextLoaderListener for each war but I can't include the other products applicationContext files because the other products may or may not have been purchased.
As seen above, the products forms cycles, so I can't load one product as the parent of another.
I've tried using "parentContextKey" off of each ContextLoaderListener but all I get is a shared parent context with two child product contexts that can't see each other. I've also looked at defining a beanRefFactory.xml for each war but I still only get multiple child product contexts that can't see each other.


Reply With Quote