From 7bd07d87eff8eae162f831f980b9e4041508ea90 Mon Sep 17 00:00:00 2001 From: abohutskyi Date: Tue, 8 Oct 2024 15:52:28 +0300 Subject: [PATCH] feat: GH-260 support writeSortedMaps property closes #260 --- .../data/aerospike/AerospikeCommonDataConfiguration.java | 1 + .../data/aerospike/AerospikeDataConfiguration.java | 1 + .../data/aerospike/AerospikeDataProperties.java | 7 +++++++ 3 files changed, 9 insertions(+) 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 49ee135..a23bacf 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 @@ -144,6 +144,7 @@ private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSe AerospikeDataProperties aerospikeDataProperties) { dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled()); dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup()); + dataSettings.setWriteSortedMaps(aerospikeDataProperties.isWriteSortedMaps()); 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 07828f1..6e32cd1 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 @@ -123,6 +123,7 @@ private AerospikeDataSettings configureDataSettings(AerospikeDataSettings dataSe AerospikeDataProperties aerospikeDataProperties) { dataSettings.setScansEnabled(aerospikeDataProperties.isScansEnabled()); dataSettings.setCreateIndexesOnStartup(aerospikeDataProperties.isCreateIndexesOnStartup()); + dataSettings.setWriteSortedMaps(aerospikeDataProperties.isWriteSortedMaps()); 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 485cc65..a1974f0 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 @@ -90,4 +90,11 @@ public class AerospikeDataProperties { * true - preserve original type if supported */ private boolean keepOriginalKeyTypes = false; + + /** + * Define how Maps and POJOs are written: true - as sorted maps (TreeMaps, default), false - as unsorted (HashMaps) + * Writing unsorted maps (false) degrades performance of Map-related operations and does not allow comparing Maps, + * strongly recommended not to use except during upgrade from older versions of Spring Data Aerospike (if required) + */ + private boolean writeSortedMaps = true; }