4

springboot 中如何读取配置文件中的动态名称的参数

 2 years ago
source link: https://www.v2ex.com/t/798375
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

springboot 中如何读取配置文件中的动态名称的参数

  gibber · 1 天前 · 595 次点击

想在配置文件中加入多数据源配置 但数据源的数量是不确定的 如果在 properties 中按如下方式配置有没有办法可以读取 db1.type=mysql db1.url=xxx db1.username=xxx db1.password=xxx

db2.type=oracle db2.url=xxx db2.username=xxx db2.password=xxx ...

其中 db1, db2 是可变的


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK