pull/34508/head
Stephane Nicoll 2 years ago
parent 95f07484a8
commit 7cf28680c9

@ -54,9 +54,9 @@ public final class ContainerConnectionSource<D extends ConnectionDetails, C exte
private final C container;
private String acceptedConnectionName;
private final String acceptedConnectionName;
private Set<Class<?>> acceptedConnectionDetailsTypes;
private final Set<Class<?>> acceptedConnectionDetailsTypes;
ContainerConnectionSource(String beanNameSuffix, Origin origin, C container,
MergedAnnotation<ServiceConnection> annotation) {
@ -100,8 +100,8 @@ public final class ContainerConnectionSource<D extends ConnectionDetails, C exte
.formatted(this, connectionName, this.acceptedConnectionName)));
return false;
}
if (!this.acceptedConnectionDetailsTypes.isEmpty() && !this.acceptedConnectionDetailsTypes.stream()
.anyMatch((candidate) -> candidate.isAssignableFrom(connectionDetailsType))) {
if (!this.acceptedConnectionDetailsTypes.isEmpty() && this.acceptedConnectionDetailsTypes.stream()
.noneMatch((candidate) -> candidate.isAssignableFrom(connectionDetailsType))) {
logger.trace(LogMessage.of(() -> "%s not accepted as connection details type %s not in %s".formatted(this,
connectionDetailsType, this.acceptedConnectionDetailsTypes)));
return false;

@ -72,8 +72,8 @@ class ServiceConnectionContextCustomizerFactory implements ContextCustomizerFact
+ StringUtils.capitalize(field.getName());
Origin origin = new FieldOrigin(field);
Object fieldValue = getFieldValue(field);
Assert.state(Container.class.isInstance(fieldValue), () -> "Field '%s' in %s must be a %s"
.formatted(field.getName(), field.getDeclaringClass().getName(), Container.class.getName()));
Assert.state(fieldValue instanceof Container, () -> "Field '%s' in %s must be a %s".formatted(field.getName(),
field.getDeclaringClass().getName(), Container.class.getName()));
Container<?> container = (Container<?>) fieldValue;
return new ContainerConnectionSource<>(beanNameSuffix, origin, container, annotation);
}

@ -68,11 +68,6 @@ class RabbitContainerConnectionDetailsFactory
return this.container.getAdminPassword();
}
@Override
public String getVirtualHost() {
return null;
}
@Override
public List<Address> getAddresses() {
URI uri = URI.create(this.container.getAmqpUrl());

Loading…
Cancel
Save