Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

跑通了,但看代码的时候有点问题 #4

Open
yedongWUXI opened this issue Sep 19, 2019 · 2 comments
Open

跑通了,但看代码的时候有点问题 #4

yedongWUXI opened this issue Sep 19, 2019 · 2 comments

Comments

@yedongWUXI
Copy link

司项目也有多数据源的需求,就来看了博主。扒代码的过程中有点问题
有些代码是不是没有用到呀?比如@DynamicDataSource这个注解,
@ConfigurationProperties( prefix = "aidijing.transactional" ) 这个是之前写在yml里后面写成final然后没删掉吗?

还有我想请教下,两年过去了,博主现在有更好的多数据源方案了吗?望提示下,多谢!

@yujunhao8831
Copy link
Owner

@ConfigurationProperties( prefix = "aidijing.transactional" ) 是为了这些参数准备的,能够支持自定义,在配置文件中可配

customizeTransactionBeanNames
customizeReadOnlyMethodRuleTransactionAttributes
customizeRequiredMethodRuleTransactionAttributes

@DynamicDataSource 这个注解有用,只是demo没有使用,没体现出来,DataSourceSwitchMethodInterceptor里面有判断处理的.

一般情况不会在同一个项目中出现多数据源,多数据源一般用多服务解决,微服务这种概念解决.
只是遇到一些没办法的项目就会出现这种情况

@yedongWUXI
Copy link
Author

嗯嗯 多谢大佬 同意大佬的想法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants