【发布时间】:2022-01-14 23:10:59
【问题描述】:
我有使用 Java Spring 在 Excel 中导入 15.000 行的代码,在生产环境中大约需要 10 分钟,但在开发环境中只需要大约 5 分钟,我该如何提高性能?这是我的代码。
流程代码:
- 检查行 Excel 是否可以保存
- 按 1 保存到数据库 1
开始检查行 excel
Cell currentCell = cellsInRow.next();
String uuidAsString = uuid.toString();
Date today = Calendar.getInstance().getTime();
if(cellIndex==0) {
ble.setA(currentCell.getStringCellValue());
} else if(cellIndex==1) {
ble.setB(currentCell.getStringCellValue());
} else if(cellIndex==2) {
ble.setC(currentCell.getDateCellValue());
}
开始后
blacklistExternalRepository.saveAll(lstBlacklistExternal);
【问题讨论】:
标签: java spring database import