Reputation: 13587
What is the best way to configure Datasources if application server may change client to client?
I have originally specified it in the application server itself. But now application servers are changing client to client. Clients are using many different application servers as JBOSS,Tomcat or Websphere etc.
Now it is becoming tedious for me as now it has to be configured as per the client specific server and I have to understand their application server configuartion.
That is why now I am moving datasource configuration to Spring's application context.
Upvotes: 3
Views: 1619
Reputation: 171
I prefer configuring the database connection on the application level.
A good way to achieve this would be to define the relevant connection settings in a properties file located outside you web application, eg "/home/myuser/mywebapp/database.properties". You can then configure your spring application to read the properties from this file and create your datasource accordingly.
This way you can
Upvotes: 1
Reputation: 24791
There's a good alternative of keeping the datasource configuration within a database itself.
The web application is given the details for the master-config db, from where it reads the configuration for other databases.
Advantages:
Disadvantage:
Upvotes: 1