Fix new Sonar smells
This commit is contained in:
@@ -196,26 +196,7 @@ public class ConsumerEndpointFactoryBean
|
||||
"Consider specifying the 'beanName' property on this ConsumerEndpointFactoryBean.");
|
||||
}
|
||||
else {
|
||||
try {
|
||||
if (!this.beanName.startsWith("org.springframework")) {
|
||||
MessageHandler targetHandler = this.handler;
|
||||
if (AopUtils.isAopProxy(targetHandler)) {
|
||||
Object target = ((Advised) targetHandler).getTargetSource().getTarget();
|
||||
if (target instanceof MessageHandler) {
|
||||
targetHandler = (MessageHandler) target;
|
||||
}
|
||||
}
|
||||
if (targetHandler instanceof IntegrationObjectSupport) {
|
||||
((IntegrationObjectSupport) targetHandler).setComponentName(this.beanName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Could not set component name for handler "
|
||||
+ this.handler + " for " + this.beanName + " :" + e.getMessage());
|
||||
}
|
||||
}
|
||||
populateComponentNameIfAny();
|
||||
}
|
||||
|
||||
if (!(this.handler instanceof ReactiveMessageHandlerAdapter)) {
|
||||
@@ -230,6 +211,29 @@ public class ConsumerEndpointFactoryBean
|
||||
initializeEndpoint();
|
||||
}
|
||||
|
||||
private void populateComponentNameIfAny() {
|
||||
try {
|
||||
if (!this.beanName.startsWith("org.springframework")) {
|
||||
MessageHandler targetHandler = this.handler;
|
||||
if (AopUtils.isAopProxy(targetHandler)) {
|
||||
Object target = ((Advised) targetHandler).getTargetSource().getTarget();
|
||||
if (target instanceof MessageHandler) {
|
||||
targetHandler = (MessageHandler) target;
|
||||
}
|
||||
}
|
||||
if (targetHandler instanceof IntegrationObjectSupport) {
|
||||
((IntegrationObjectSupport) targetHandler).setComponentName(this.beanName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Could not set component name for handler "
|
||||
+ this.handler + " for " + this.beanName + " :" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void adviceChain() {
|
||||
if (!CollectionUtils.isEmpty(this.adviceChain)) {
|
||||
/*
|
||||
|
||||
@@ -105,9 +105,9 @@ public class ReactiveMongoDbStoringMessageHandler extends AbstractReactiveMessag
|
||||
super.onInit();
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
|
||||
if (this.mongoTemplate == null) {
|
||||
ReactiveMongoTemplate mongoTemplate = new ReactiveMongoTemplate(this.mongoDbFactory, this.mongoConverter);
|
||||
mongoTemplate.setApplicationContext(getApplicationContext());
|
||||
this.mongoTemplate = mongoTemplate;
|
||||
ReactiveMongoTemplate template = new ReactiveMongoTemplate(this.mongoDbFactory, this.mongoConverter);
|
||||
template.setApplicationContext(getApplicationContext());
|
||||
this.mongoTemplate = template;
|
||||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user