Remove some of the field injections (Sonar recomendtion) (#2218)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -60,15 +60,22 @@ import org.springframework.util.ErrorHandler;
|
||||
@PropertySource("classpath:/hawkbit-dmf-defaults.properties")
|
||||
public class AmqpConfiguration {
|
||||
|
||||
@Autowired
|
||||
private AmqpProperties amqpProperties;
|
||||
@Autowired
|
||||
private AmqpDeadletterProperties amqpDeadletterProperties;
|
||||
@Autowired
|
||||
private ConnectionFactory rabbitConnectionFactory;
|
||||
@Autowired(required = false)
|
||||
private final AmqpProperties amqpProperties;
|
||||
private final AmqpDeadletterProperties amqpDeadletterProperties;
|
||||
private final ConnectionFactory rabbitConnectionFactory;
|
||||
private ServiceMatcher serviceMatcher;
|
||||
|
||||
public AmqpConfiguration(final AmqpProperties amqpProperties, final AmqpDeadletterProperties amqpDeadletterProperties, final ConnectionFactory rabbitConnectionFactory) {
|
||||
this.amqpProperties = amqpProperties;
|
||||
this.amqpDeadletterProperties = amqpDeadletterProperties;
|
||||
this.rabbitConnectionFactory = rabbitConnectionFactory;
|
||||
}
|
||||
|
||||
@Autowired(required = false) // spring setter injection
|
||||
public void setServiceMatcher(final ServiceMatcher serviceMatcher) {
|
||||
this.serviceMatcher = serviceMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a custom error handler bean.
|
||||
*
|
||||
@@ -262,8 +269,7 @@ public class AmqpConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create RabbitListenerContainerFactory bean if no listenerContainerFactory
|
||||
* bean found
|
||||
* Create RabbitListenerContainerFactory bean if no listenerContainerFactory bean found
|
||||
*
|
||||
* @return RabbitListenerContainerFactory bean
|
||||
*/
|
||||
|
||||
@@ -215,8 +215,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
||||
return StringUtils.hasLength(message.getMessageProperties().getCorrelationId());
|
||||
}
|
||||
|
||||
// Exception squid:MethodCyclomaticComplexity - false positive, is a simple mapping
|
||||
@SuppressWarnings("squid:MethodCyclomaticComplexity")
|
||||
@SuppressWarnings("java:S2637" ) // java:S2637 - logAndThrowMessageError throws exception, i.e. doesn't return null
|
||||
private static @NotNull Status mapStatus(final Message message, final DmfActionUpdateStatus actionUpdateStatus, final Action action) {
|
||||
Status status = null;
|
||||
switch (actionUpdateStatus.getActionStatus()) {
|
||||
@@ -261,7 +260,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
logAndThrowMessageError(message, "Status for action does not exisit.");
|
||||
logAndThrowMessageError(message, "Status for action does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user