|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2021 the original author or authors.
|
|
|
|
|
* Copyright 2012-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.
|
|
|
|
@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.hazelcast;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import com.hazelcast.config.Config;
|
|
|
|
|
import com.hazelcast.config.JoinConfig;
|
|
|
|
|
import com.hazelcast.config.QueueConfig;
|
|
|
|
|
import com.hazelcast.core.Hazelcast;
|
|
|
|
|
import com.hazelcast.core.HazelcastInstance;
|
|
|
|
@ -130,8 +131,7 @@ class HazelcastAutoConfigurationServerTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void configInstanceWithName() {
|
|
|
|
|
Config config = new Config("my-test-instance");
|
|
|
|
|
config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
|
|
|
|
|
Config config = createTestConfig("my-test-instance");
|
|
|
|
|
HazelcastInstance existing = Hazelcast.newHazelcastInstance(config);
|
|
|
|
|
try {
|
|
|
|
|
this.contextRunner.withUserConfiguration(HazelcastConfigWithName.class)
|
|
|
|
@ -165,6 +165,14 @@ class HazelcastAutoConfigurationServerTests {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Config createTestConfig(String instanceName) {
|
|
|
|
|
Config config = new Config(instanceName);
|
|
|
|
|
JoinConfig join = config.getNetworkConfig().getJoin();
|
|
|
|
|
join.getAutoDetectionConfig().setEnabled(false);
|
|
|
|
|
join.getMulticastConfig().setEnabled(false);
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
static class HazelcastConfigWithName {
|
|
|
|
|
|
|
|
|
@ -180,8 +188,7 @@ class HazelcastAutoConfigurationServerTests {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
Config anotherHazelcastConfig() {
|
|
|
|
|
Config config = new Config();
|
|
|
|
|
config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
|
|
|
|
|
Config config = createTestConfig("another-test-instance");
|
|
|
|
|
config.addQueueConfig(new QueueConfig("another-queue"));
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|