java Guice多数据库自动切换
我有三个数据库共同语言
- 单元测试环境的本地数据库
- 开发环境的测试数据库
- 产品环境在线数据库
如何根据环境自动注入不同的db属性
By using xml with spring, I can use maven profiles and Resources filter feature to have this work done.
guice的解决方案是什么
你可以在下面搜索框中键入要查询的问题!
我有三个数据库共同语言
如何根据环境自动注入不同的db属性
By using xml with spring, I can use maven profiles and Resources filter feature to have this work done.
guice的解决方案是什么
# 1 楼答案
在最简单的情况下,您可以在
Module
中使用binder.bindConstant()
,如下所示:你可以这样使用:
如何在程序开始时设置系统属性取决于您
另一种类似的方法是实用方法
cNames.bindProperties(Binder, Map<String, String>)
,您可以一次性设置任意属性