Dependency Injection: How to maintain multiple configurations?
Posted
by Malax
on Stack Overflow
See other posts from Stack Overflow
or by Malax
Published on 2009-11-10T13:01:42Z
Indexed on
2010/05/18
3:10 UTC
Read the original article
Hit count: 318
Hi StackOverflow,
Lets assume we've build a system with a DI framework which is working quite fine. This system currently uses JMS to "talk" with other systems not maintained by us. The majority of our customers like the JMS approach and uses it according to our specification. The component which does all the messaging is injected with Spring into the rest of the application.
Now we got the case that one customer cannot implement the JMS solution and want to use another messaging technology. Thats not a problem because we can simply implement a messaging service using this technology and inject it in the rest of the application.
But how are we supposed to handle the deployment and maintenance of the configuration? Since the application uses Spring i could imagine to check in all the configurations i have for this application and the system administrator could start the application and passing the name of the DI XML file to specify which configuration should be loaded. But... it just don't feel right. Are there any solutions for such cases available? What are the best-practices you use? I could even imagine more complex scenarios which do not contain only one service substitution...
Thanks a lot!
© Stack Overflow or respective owner