-
Notifications
You must be signed in to change notification settings - Fork 2.2k
建议对springboot增加连接池组件 #60
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
Comments
@TommyLemon 目前连接池管理是否已经完善了? |
可以在 DemoSQLExecutor 重写 getConnection public Connection getConnection(..) {
Connection c = connectionMap.get(config.getDatabase());
if (c == null || c.isClosed()) {
c = DruidConfig.DATA_SOURCE.getConnection();
connectionMap.put(config.getDatabase(), c); // DruidConfig 初始化获取到 Datasource 后给静态变量 DATA_SOURCE 赋值,或者也可以试试 ApplicationContext.getBean(DruidConfig.class).getDataSource()
}
return super.getConnection(..); // 必须最后执行,因为里面还有事务相关处理。如果这里是 return c,则会导致 增删改 多个对象时只有第一个会 commit,即只有第一个对象成功插入数据库表
} |
@k4n5ha0 @yangjinju 已完善。 新增数据源关键词 @Datasource,可由业务完全自定义 新增 连接池及多数据源 Demo(Druid + HikariCP) |
我看了一下工程目录 似乎没有使用数据库连接池
直接操作jdbc对性能影响很大
希望作者 提供连接池相关的技术支持
谢谢
另外建议使用undertow以替换tomcat
undertow性能比tomcat好很多
The text was updated successfully, but these errors were encountered: