Spring: two database configurations online/offline
Is there a method to have two configurations that automatically use one when online and another when loc开发者_JAVA百科al?
I mean two connections saved, one for the online version (when I try my website on another server) and one for my local tests...
Sorry for my bad english, I hope that someone can understand what i mean
Yes it is possible,
I assume that your database beans are defined in a spring context file.
You have 2 choices:
- You can either put the online and offline beans in separate contexts and load them depending upon an environment variable
- Or you can simply pass the context files as parameters to your application and fire up spring manually
精彩评论