Comments (3)
你可以通过DSFactory.create(dbSetting).getDataSource(dbSourceName)
来自定义Setting的位置。
final Setting dbSetting = new Setting("config/db.setting");
final DataSource dataSource = DSFactory.create(dbSetting).getDataSource("");
from hutool.
你可以通过
DSFactory.create(dbSetting).getDataSource(dbSourceName)
来自定义Setting的位置。final Setting dbSetting = new Setting("config/db.setting"); final DataSource dataSource = DSFactory.create(dbSetting).getDataSource("");
这个用法还是不够灵活,配置固定写死在配置文件了。如果同时还支持环境变量覆盖配置的话就可以一次打包,可以在任何地方执行,只需修改环境变量或者命令行参数而不用修改配置文件。
from hutool.
要想灵活又简便,这个其实很难做到。
使用环境变量的问题在于太隐蔽了。例如你项目中自定义了环境变量,这个变量是个全局值,一旦协作人员修改了这个值,别人不知道哪里修改了,很难排查问题。
from hutool.
Related Issues (20)
- ReflectUtil 的疑问:getFieldValue方法每次都循环查找指定的 Field HOT 1
- FastDateFormat 解析 WeekYear 结果与预期不符 HOT 1
- ClassUtil.scanPackageBySuper 偶发性报错,java.lang.IllegalStateException: zip file closed HOT 2
- 建议hutool-bom版本管理可以包含hutool-all HOT 1
- DateUtil.lastWeek()在sout下是日期格式,put到json就变成时间戳格式了,这是否算是个bug HOT 1
- 从5.7升级5.8以后,BeanUtil.copyProperties 复制map,map的key从Long变成了字符串 HOT 1
- SM2加密速度慢 SecureUtil.generateKeyPair("SM2");加入这段代码后由1000ms变几十毫秒 HOT 1
- cn.hutool.http.HttpException: Unexpected end of file from server HOT 1
- BeanUtil对代理类型源对象拷贝失败 HOT 1
- JSONUtil.toBean时,如果Bean没有任何字段,会报错ConvertException: Can not Converter from [cn.hutool.json.JSONObject] to [xxx] HOT 6
- byte[]和数值转换问题咨询 HOT 3
- 根据身份证计算年龄逻辑不准确 HOT 1
- csv字段分隔符只能设置单个字符 HOT 1
- 在使用 hutool DB时的一些疑惑 HOT 3
- 建议:用文档训练一个AI,这样找方法的时候直接在AI里问 HOT 1
- java.lang.NoSuchMethodError
- HttpUtil工具get方法请求头Content-Type设置问题 HOT 1
- StrUtil split 判断问题 HOT 6
- Convert.digitToChinese(0),按照标准读法应该返回“零元整” HOT 3
- 有没有整合ip2region的计划 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hutool.