Skip to content

Commit ffa1998

Browse files
committed
Fix Sonar issue from previous commit
1 parent f80ecf1 commit ffa1998

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spring-integration-ip/src/main/java/org/springframework/integration/ip/config/TcpConnectionFactoryFactoryBean.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.concurrent.Executor;
2020

2121
import org.springframework.beans.BeansException;
22+
import org.springframework.beans.factory.BeanFactory;
2223
import org.springframework.beans.factory.BeanNameAware;
2324
import org.springframework.beans.factory.config.AbstractFactoryBean;
2425
import org.springframework.context.ApplicationContext;
@@ -155,8 +156,9 @@ public Class<?> getObjectType() {
155156

156157
@Override
157158
protected AbstractConnectionFactory createInstance() {
158-
if (!this.mapperSet) {
159-
this.mapper.setBeanFactory(getBeanFactory());
159+
BeanFactory beanFactory = getBeanFactory();
160+
if (!this.mapperSet && beanFactory != null) {
161+
this.mapper.setBeanFactory(beanFactory);
160162
}
161163
if (this.usingNio) {
162164
if (isServer()) {
@@ -199,7 +201,9 @@ protected AbstractConnectionFactory createInstance() {
199201
this.connectionFactory = factory;
200202
}
201203
}
202-
this.connectionFactory.setBeanFactory(getBeanFactory());
204+
if (beanFactory != null) {
205+
this.connectionFactory.setBeanFactory(beanFactory);
206+
}
203207
if (this.applicationContext != null) {
204208
this.connectionFactory.setApplicationContext(this.applicationContext);
205209
}

0 commit comments

Comments
 (0)