开发者

Spring: two database configurations online/offline

开发者 https://www.devze.com 2023-02-27 02:41 出处:网络
Is there a method to have two configurations that automatically use one when online and another when loc开发者_JAVA百科al?

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
0

精彩评论

暂无评论...
验证码 换一张
取 消