I am currently dealing with code where there is a singleton which is used by many threads and has no state except two fields for a TransactionTemplate and a SimpleJdbcTemplate which are used in the functions of the singleton to access the database.
Is this safe or should I create a new Template, whenever I need one?
The SimpleJdbcTemplate just wraps a JdbcTemplate, so it’s thread-safe, as is the TransactionTemplate.