Comments (4)
如果不想那么麻烦,getConnection()判断closed为true时直接返回null,加上一行error日志输出能解决这个问题。
但是理论上要解决这个问题,DruidDataSource需要实现BeanPostProcessor接口且使用@Order
注解确保在spring的ConfigurationPropertiesBindingPostProcessor前执行,DruidDataSource在postProcessBeforeInitialization方法设置druidDatasource开始初始化状态、在postProcessAfterInitialization方法设置完成初始化状态,然后在getConnection方法判断这个标识,如果是开始初始化的状态,直接返回null。
我觉得你可以提交个PR。
from druid.
发现有个不常用的属性 spring.cloud.refresh.never-refreshable 可以配置为 com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper 禁止 DruidDataSource 的动态属性刷新临时解决这个问题。
spring.cloud.refresh.never-refreshable = com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper
@zrlw assign 给我吧,尝试修复下
from druid.
@whq4123 我和你一样没有权限,不过PR并不需要指派,你可以直接提交的
from druid.
今天仔细看了下,我们用的druid 1.2.21版本,这个版本有个新增的逻辑是 DruidDataSourceWrapper实现了DisposableBean 接口,我认为这个改动有问题,也是问题出现的主要原因之一:
spring在rebind的时候(不光是nacos更新配置,不确定是否有其他情况)都会调用DisposableBean的destroy方法,如果按照现在的改动,rebind会导致close连接池,那所有的链接都会断开,cache都会清空,任务线程会中断,这显然是不合适的。所以这个地方应该还原为之前的代码。
from druid.
Related Issues (20)
- SQL HOT 4
- 获取连接失败 HOT 2
- 这个问题很多年了springboot+druid+atomikos 长时间不使用数据库连接无法使用,多请求几次又可以使用了 HOT 5
- oracle.jdbc.ReadTimeout配置失效 HOT 2
- druid创建连接时报错 HOT 1
- 不支持mysql 5.7.6的ACCOUNT LOCK | ACCOUNT UNLOCK语法
- mysql SQLUtils.format sql中包含:name类型参数时 无法进行格式化
- Select语句解析注释时,最后一个字段的注释丢失 HOT 1
- Insert语句into括号里的字段不解析注释 HOT 1
- 不支持 PG SHOW search_path
- SQLDataType的isInt()接口中没有对MEDIUMINT 类型放回 HOT 3
- 审批人、
- tomcat10+Springboot3+druid1.2.21异常
- version: 1.2.20 db: sqlserver 无法通过配置参数设置sqlserver的connectionTimeout(loginTimeout) 和 socketTimeout HOT 3
- druid配置数据源报错Access denied for user 'root'@ 通过工具连接时正常的,springboot项目启动就报错 HOT 1
- druid 版本1.2.2 oracle 11g 查询 使用SQLLimit 报错 产生的语法是OFFSET * ROWS FETCH FIRST * ROWS ONLY
- druid1.2.21版本在修改nacos配置时会导致druid重新加载并丢失连接
- druid1.1.10版本,设置maxactive为80,大并发使用情况下,实测数据库连接数为300,请问是什么情况导致的? HOT 1
- druid 版本1.2.11 使用中括号语法错误
- druid-spring-boot-3-starter的版本maven仓库已经发布到1.2.21版本,是否可以正常使用? HOT 3
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 druid.