如何使用nacos config来连接数据库 #3740
Answered
by
czy88840616
KingDracula
asked this question in
Q&A
-
Describe the problem(描述问题)我使用的是Sequelize 的Repository 模式操作数据库,但是想要使用nacos config来进行数据库的配置,我尝试在onConfigLoad的方法中读取nacos来更改数据库配置,但是发现会在执行这个方法之前初始化Sequelize配置。 Midway Versions(Midway 版本) |
Beta Was this translation helpful? Give feedback.
Answered by
czy88840616
Apr 1, 2024
Replies: 1 comment 1 reply
-
1、不要在 onConfigLoad 调用任意数据库的代码避免提前初始化,包括 inject |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
KingDracula
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1、不要在 onConfigLoad 调用任意数据库的代码避免提前初始化,包括 inject
2、在 onConfigLoad 中直接用 nacos getConfig 获取配置