beginTx() {
Connection conn = ds.getConnection();
SingleConnectionDataSource scd = new SingleConnectionDataSource(conn, true);
SimpleJdbcTemplate template = new SimpleJdbcTemplate(scd);
}
I would like to reuse scd and template without having to create new scd and templates. How can I achieve that?
You could create a bean and inject it like:
But keep in mind as the doc specifies that this is primarily intended for testing and it is not working well in multi-threaded environment.