我正在将Spring-Boot 2.0.6与Spring-Batch和Spring-Data一起使用。
上下文如下。我有一个包含不同步骤的春季批处理工作:
知道我想使用JpaRepository请求我的数据库,在运行时连接数据库并配置我的存储库的最佳方法是什么。
答案 0 :(得分:0)
You need not worry about opening/closing the connections. Spring batch JPA repository's methods would automatically open the transactions/connections and terminates once the jpa repository's methods are executed or when the spring batch terminates on error. Please enable jdbc trace logs to validate the opening and closing of transactions/connections to db.