Closed
Description
Juergen Hoeller opened SPR-16570 and commented
As pointed out by #1725, AbstractBeanFactoryBasedTargetSource.getTargetClass()
and JdbcAccessor.getExceptionTranslator()
are marked as synchronized
but their corresponding setter methods aren't... which may lead to inconsistent visibility at runtime.
Since all we want to prevent there is entering the lazy initialization algorithm concurrently, we can use a volatile
field instead, only entering full synchronization when no existing instance has been found. Once initialized, we're happy to go with whatever has been set, so a volatile field is sufficient there.
Affects: 4.3.14, 5.0.4
Referenced from: commits a403a75, 7f1a8d7, 207e8c2, 1bde920, 50253f6
Backported to: 4.3.15