GH-248: Exclude Geode SSL config
Fixes https://github.com/spring-cloud/stream-applications/issues/248 The Geode SSL auto-config is done via `SslAutoConfiguration.SslEnvironmentPostProcessor` which cannot be excluded as an auto-config. * Set `SslAutoConfiguration.SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY` to `false` from the `ExcludeStoresAutoConfigurationEnvironmentPostProcessor` when the store type is not Geode
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.geode.boot.autoconfigure.ClientCacheAutoConfiguration;
|
||||
import org.springframework.geode.boot.autoconfigure.SslAutoConfiguration;
|
||||
|
||||
/**
|
||||
* An {@link EnvironmentPostProcessor} to add {@code spring.autoconfigure.exclude} property
|
||||
@@ -57,6 +58,12 @@ public class ExcludeStoresAutoConfigurationEnvironmentPostProcessor implements E
|
||||
RedisAutoConfiguration.class.getName() + ", " +
|
||||
RedisRepositoriesAutoConfiguration.class.getName());
|
||||
|
||||
String messageStoreType = environment.getProperty(AggregatorFunctionProperties.PREFIX + ".message-store-type");
|
||||
if (!AggregatorFunctionProperties.MessageStoreType.GEMFIRE.equals(messageStoreType)) {
|
||||
properties.setProperty(SslAutoConfiguration.SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY,
|
||||
"false");
|
||||
}
|
||||
|
||||
propertySources.addLast(
|
||||
new PropertiesPropertySource("aggregator.exclude.stores.auto-configuration", properties));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,8 +21,10 @@ import java.util.function.Function;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.geode.boot.autoconfigure.SslAutoConfiguration;
|
||||
import org.springframework.integration.aggregator.AggregatingMessageHandler;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -44,6 +46,9 @@ public abstract class AbstractAggregatorFunctionTests {
|
||||
@Autowired
|
||||
protected AggregatingMessageHandler aggregatingMessageHandler;
|
||||
|
||||
@Value("${" + SslAutoConfiguration.SECURITY_SSL_ENVIRONMENT_POST_PROCESSOR_ENABLED_PROPERTY + ":true}")
|
||||
protected Boolean geodeSslEnable;
|
||||
|
||||
@SpringBootApplication
|
||||
static class AggregatorFunctionTestApplication {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,6 +64,8 @@ public class DefaultAggregatorTests extends AbstractAggregatorFunctionTests {
|
||||
|
||||
assertThat(this.messageGroupStore).isNull();
|
||||
assertThat(this.aggregatingMessageHandler.getMessageStore()).isInstanceOf(SimpleMessageStore.class);
|
||||
|
||||
assertThat(this.geodeSslEnable).isFalse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,6 +61,8 @@ public class GroupTimeOutAndGemfireMessageStoreAggregatorTests extends AbstractA
|
||||
|
||||
assertThat(this.messageGroupStore).isInstanceOf(GemfireMessageStore.class);
|
||||
assertThat(this.aggregatingMessageHandler.getMessageStore()).isSameAs(this.messageGroupStore);
|
||||
|
||||
assertThat(this.geodeSslEnable).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,6 +67,8 @@ public class JdbcMessageStoreAggregatorTests extends AbstractAggregatorFunctionT
|
||||
assertThat(this.messageGroupStore).isInstanceOf(JdbcMessageStore.class);
|
||||
|
||||
assertThat(this.aggregatingMessageHandler.getMessageStore()).isSameAs(this.messageGroupStore);
|
||||
|
||||
assertThat(this.geodeSslEnable).isFalse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user