* See {@link com.aerospike.client.Host#parseHosts} documentation for more details. + * + * @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.connection". + * will be used instead to read from application.properties */ + @Deprecated(since = "0.14.0", forRemoval = true) private String hosts; /** * Port is used if no port specified in AerospikeProperties#hosts. *
* See {@link com.aerospike.client.Host#parseHosts} documentation for more details.
+ *
+ * @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.connection".
+ * will be used instead to read from application.properties
*/
+ @Deprecated(since = "0.14.0", forRemoval = true)
private int defaultPort = 3000;
/**
diff --git a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeCommonDataConfiguration.java b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeCommonDataConfiguration.java
index dedd01a..d7b0994 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeCommonDataConfiguration.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeCommonDataConfiguration.java
@@ -7,6 +7,7 @@
import org.springframework.boot.autoconfigure.domain.EntityScanner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
+import org.springframework.data.aerospike.config.AerospikeConnectionSettings;
import org.springframework.data.aerospike.config.AerospikeDataSettings;
import org.springframework.data.aerospike.convert.AerospikeCustomConversions;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
@@ -58,9 +59,10 @@ public IndexesCacheHolder aerospikeIndexCache() {
public MappingAerospikeConverter mappingAerospikeConverter(AerospikeMappingContext aerospikeMappingContext,
AerospikeTypeAliasAccessor aerospikeTypeAliasAccessor,
AerospikeCustomConversions aerospikeCustomConversions,
- AerospikeDataProperties aerospikeDataProperties) {
+ AerospikeDataProperties aerospikeDataProperties,
+ AerospikeDataSettings dataSettings) {
return new MappingAerospikeConverter(aerospikeMappingContext, aerospikeCustomConversions,
- aerospikeTypeAliasAccessor, aerospikeDataSettings(aerospikeDataProperties));
+ aerospikeTypeAliasAccessor, aerospikeDataSettings(aerospikeDataProperties, dataSettings));
}
@Bean(name = "aerospikeTypeAliasAccessor")
@@ -98,16 +100,25 @@ public AerospikeExceptionTranslator aerospikeExceptionTranslator() {
return new DefaultAerospikeExceptionTranslator();
}
- private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties) {
- AerospikeDataSettings.AerospikeDataSettingsBuilder builder = AerospikeDataSettings.builder();
- configureDataSettings(builder, aerospikeDataProperties);
- return builder.build();
+ @Bean
+ public AerospikeDataSettings readAerospikeDataSettings() {
+ return new AerospikeDataSettings();
}
- private void configureDataSettings(AerospikeDataSettings.AerospikeDataSettingsBuilder builder,
- AerospikeDataProperties aerospikeDataProperties) {
- builder.scansEnabled(aerospikeDataProperties.isScansEnabled());
- builder.sendKey(aerospikeDataProperties.isSendKey());
- builder.createIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
+ @Bean
+ public AerospikeConnectionSettings readAerospikeSettings() {
+ return new AerospikeConnectionSettings();
+ }
+
+ private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties,
+ AerospikeDataSettings dataSettings) {
+ return configureDataSettings(dataSettings, aerospikeDataProperties);
+ }
+
+ private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSettings,
+ AerospikeDataProperties aerospikeDataProperties) {
+ dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled());
+ dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
+ return dataSettings;
}
}
diff --git a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataConfiguration.java b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataConfiguration.java
index 3bcafbe..9bbe468 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataConfiguration.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataConfiguration.java
@@ -82,11 +82,12 @@ public QueryEngine aerospikeQueryEngine(IAerospikeClient aerospikeClient,
@ConditionalOnMissingBean(name = "aerospikeIndexRefresher")
public IndexRefresher indexRefresher(IAerospikeClient aerospikeClient, IndexesCacheUpdater indexesCacheUpdater,
ServerVersionSupport serverVersionSupport,
- AerospikeDataProperties aerospikeDataProperties) {
+ AerospikeDataProperties aerospikeDataProperties,
+ AerospikeDataSettings dataSettings) {
IndexRefresher refresher = new IndexRefresher(aerospikeClient, aerospikeClient.getInfoPolicyDefault(),
new InternalIndexOperations(new IndexInfoParser()), indexesCacheUpdater, serverVersionSupport);
refresher.refreshIndexes();
- int refreshFrequency = aerospikeDataSettings(aerospikeDataProperties).getIndexCacheRefreshSeconds();
+ int refreshFrequency = aerospikeDataSettings(aerospikeDataProperties, dataSettings).getIndexCacheRefreshSeconds();
processCacheRefreshFrequency(refreshFrequency, refresher);
return refresher;
}
@@ -111,16 +112,15 @@ public AerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCre
aerospikeDataProperties.isCreateIndexesOnStartup(), aerospikeIndexResolver, template);
}
- private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties) {
- AerospikeDataSettings.AerospikeDataSettingsBuilder builder = AerospikeDataSettings.builder();
- configureDataSettings(builder, aerospikeDataProperties);
- return builder.build();
+ private AerospikeDataSettings aerospikeDataSettings(AerospikeDataProperties aerospikeDataProperties,
+ AerospikeDataSettings dataSettings) {
+ return configureDataSettings(dataSettings, aerospikeDataProperties);
}
- private void configureDataSettings(AerospikeDataSettings.AerospikeDataSettingsBuilder builder,
- AerospikeDataProperties aerospikeDataProperties) {
- builder.scansEnabled(aerospikeDataProperties.isScansEnabled());
- builder.sendKey(aerospikeDataProperties.isSendKey());
- builder.createIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
+ private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSettings,
+ AerospikeDataProperties aerospikeDataProperties) {
+ dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled());
+ dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup());
+ return dataSettings;
}
}
diff --git a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataProperties.java b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataProperties.java
index 5beb847..7a7d2bf 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataProperties.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/main/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataProperties.java
@@ -23,7 +23,8 @@
/**
* Configuration properties for Spring Data Aerospike.
- * @deprecated since 0.14.0, {@link AerospikeDataSettings} will be used instead.
+ * @deprecated since 0.14.0, {@link AerospikeDataSettings} with the prefix "spring-data-aerospike.data".
+ * will be used instead to read from application.properties.
*
* @author Igor Ermolenko
* @author Anastasiia Smirnova
diff --git a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataAutoConfigurationTest.java b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataAutoConfigurationTest.java
index abf9d50..9e392b1 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataAutoConfigurationTest.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeDataAutoConfigurationTest.java
@@ -27,6 +27,7 @@
import org.springframework.boot.autoconfigure.data.aerospike.city.City;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.data.aerospike.convert.AerospikeConverter;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.data.aerospike.convert.MappingAerospikeConverter;
import org.springframework.data.aerospike.core.AerospikeTemplate;
@@ -76,7 +77,7 @@ public void entityScanShouldSetInitialEntitySet() {
}
@Test
- public void typeKeyDefault() {
+ public void classKeyDefault() {
contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
@@ -84,10 +85,9 @@ public void typeKeyDefault() {
AerospikeServerVersionSupportMockConfiguration.class)
.run(context -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
- String typeKey = getField(aliasAccessor, "typeKey");
- String defaultTypeKey = getField(aliasAccessor, "TYPE_KEY");
+ String classKey = getField(aliasAccessor, "classKey");
- assertThat(typeKey).isEqualTo(defaultTypeKey);
+ assertThat(classKey).isEqualTo(AerospikeConverter.CLASS_KEY);
});
}
@@ -101,7 +101,7 @@ public void typeKeyCanBeCustomized() {
.withPropertyValues("spring.data.aerospike.type-key=++amazing++")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
- String typeKey = getField(aliasAccessor, "typeKey");
+ String typeKey = getField(aliasAccessor, "classKey");
assertThat(typeKey).isEqualTo("++amazing++");
});
@@ -117,7 +117,7 @@ public void typeKeyCanBeNull() {
.withPropertyValues("spring.data.aerospike.type-key=")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
- String typeKey = getField(aliasAccessor, "typeKey");
+ String typeKey = getField(aliasAccessor, "classKey");
assertThat(typeKey).isNull();
});
diff --git a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeReactiveDataAutoConfigurationTest.java b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeReactiveDataAutoConfigurationTest.java
index 0be59b4..10fdcc6 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeReactiveDataAutoConfigurationTest.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/AerospikeReactiveDataAutoConfigurationTest.java
@@ -26,6 +26,7 @@
import org.springframework.boot.autoconfigure.data.aerospike.AerospikeTestConfigurations.MockReactiveIndexRefresher;
import org.springframework.boot.autoconfigure.data.aerospike.city.City;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.data.aerospike.convert.AerospikeConverter;
import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.data.aerospike.convert.MappingAerospikeConverter;
import org.springframework.data.aerospike.core.AerospikeTemplate;
@@ -74,7 +75,7 @@ public void entityScanShouldSetInitialEntitySet() {
}
@Test
- public void typeKeyDefault() {
+ public void classKeyDefault() {
contextRunner
.withPropertyValues("spring.aerospike.hosts=localhost:3000")
.withPropertyValues("spring.data.aerospike.namespace=TEST")
@@ -82,10 +83,9 @@ public void typeKeyDefault() {
AerospikeServerVersionSupportMockConfiguration.class)
.run(context -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
- String typeKey = getField(aliasAccessor, "typeKey");
- String defaultTypeKey = getField(aliasAccessor, "TYPE_KEY");
+ String typeKey = getField(aliasAccessor, "classKey");
- assertThat(typeKey).isEqualTo(defaultTypeKey);
+ assertThat(typeKey).isEqualTo(AerospikeConverter.CLASS_KEY);
});
}
@@ -99,7 +99,7 @@ public void typeKeyCanBeCustomized() {
.withPropertyValues("spring.data.aerospike.type-key=++amazing++")
.run((context) -> {
AerospikeTypeAliasAccessor aliasAccessor = context.getBean(AerospikeTypeAliasAccessor.class);
- String typeKey = getField(aliasAccessor, "typeKey");
+ String typeKey = getField(aliasAccessor, "classKey");
assertThat(typeKey).isEqualTo("++amazing++");
});
diff --git a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/TestUtils.java b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/TestUtils.java
index 1fb1e65..7b1e4fb 100644
--- a/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/TestUtils.java
+++ b/spring-boot-autoconfigure-data-aerospike/src/test/java/org/springframework/boot/autoconfigure/data/aerospike/TestUtils.java
@@ -1,15 +1,14 @@
package org.springframework.boot.autoconfigure.data.aerospike;
-import org.springframework.data.aerospike.convert.AerospikeTypeAliasAccessor;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
public class TestUtils {
- public static