Some object factories aren't thread-safe and thus do not allow calling org.apache.commons.pool.PoolableObjectFactory#makeObject from within multiple threads. Commons-pool library provides convenient PoolUtils#synchronizedPool method to synchronize such factories. I can take advantage of this method by simply extending org.springframework.aop.target.CommonsPoolTargetSource:
However it would be nice if CommonsPoolTargetSource itself had an option to synchronize the pool if required. Implementation is pretty straightforward (in org.springframework.aop.target.CommonsPoolTargetSource#createObjectPool):
where synchronizedPool would be accessible as factory property (field+setter).