Technically you can use SingleConnectionDataSource
new JdbcTemplate(new SingleConnectionDataSource(connection, false))
However, this is not entirely appropriate if, for example, for unit tests.
It's better to use full-featured DataSourceand wired stuff using spring.
source
share