AMQ-2960: Fixed potential NPE in pooled connection factory in activemq-spring when using spring-dm in OSGi. As spring-dm may call getObject before postCostruct has been called.

This commit is contained in:
Claus Ibsen 2013-11-03 13:40:38 +01:00
parent d0f48b3ee5
commit 4ddbb8546d
1 changed files with 4 additions and 1 deletions

View File

@ -185,9 +185,12 @@ public class PooledConnectionFactoryBean implements FactoryBean {
} }
} }
// FactoryBean methods
@Override @Override
public Object getObject() throws Exception { public Object getObject() throws Exception {
// in case spring-dm calls getObject before this bean has been initialized
if (pooledConnectionFactory == null) {
afterPropertiesSet();
}
return pooledConnectionFactory; return pooledConnectionFactory;
} }