Instances of the JdbcTemplate class are threadsafe once configured. This is important because it means that you can configure a single instance of a JdbcTemplate and then safely inject this shared reference into multiple DAOs (or repositories). The JdbcTemplate is stateful, in that it maintains a reference to a DataSource, but this state is not conversational state.
It is awesome!
Recently I look to JdbcDaoSupport in order to simplify code and investigate that there are simpler approach:
Oleksandr Gavenko opened SPR-11478 and commented
Official docs:
http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/jdbc.html#jdbc-JdbcTemplate-idioms
state that:
It is awesome!
Recently I look to JdbcDaoSupport in order to simplify code and investigate that there are simpler approach:
http://stackoverflow.com/a/21992433/173149
with simply:
But javadoc doesn't say anything about thread safety for
I investigate sources and didn't found any state in this classes.
Is that classes thread safe?
Is them can be configured in context and reused across DAO code by injecting?
My goal to avoid such code:
and have only
@Autowired NamedParameterJdbcTemplate namedTemplate;
.Please update javadoc for this classes if them are thread safe so any developer doesn't afraid to use them in convenient way...
No further details from SPR-11478
The text was updated successfully, but these errors were encountered: