Mar 25th, 2010, 09:06 PM
Spring web app, multiple domains
Hi I have a web app product that I deploy for each one of my clients (on their separate domains). My goal is to have only one app which all the clients can hit, however Im not sure how to accomplish this using Spring. Currently each project for each client has its own applicationContext-web.xml files which define the different beans that my application is using (some of the beans are passed specific parameters like below.
<bean id="dataService" class="com.xxx.DataServiceImpl">
<property name="dataUrl" value="http://specificurl.net/data"/>
Is there anyway for me to just have one web app which is domain aware and can make sure to load the right bean depending on the domain?
This is much better than having many instances of my app running on different servers (the real difference is just the config).
Last edited by yourtechness; Mar 25th, 2010 at 11:01 PM.
Mar 26th, 2010, 03:32 AM
Your problem falls apart into two parts:
Redirecting different domains to one server: Network stuff
Deploying the same application with different configurations:
That's what JNDI and "java:comp/env" is for. This works not only for data sources, but also for strings, URLs, JMS connection factories, JMS destinations etc. Even Tomcat allows you to create one such context per application. You will find examples on how to do that on their website. Spring's reference manual will tell you how to access JNDI resources.