CustomConversions and setDefaultNameSpace in AS client 5.1.11


I am upgrading Aerospike client 4.1.3 → 5.1.11. Please help me to clear doubts on below 2 points.

1. CustomConversions constructor - In Older Version of CustomConversions constructor first parameter was List<?> converters so I have passed values Arrays.asList(StringToJava8LocalDateConverter.INSTANCE, Java8LocalDateToStringConverter.INSTANCE). But in New Version first parameter is StoreConversions so I am passing StoreConversions.of(AerospikeSimpleTypes.HOLDER,Collections.emptyList()). Please suggest if this is the correct way to use CustomConversions constructor.

2. setDefaultNameSpace - In older version I was setting setDefaultNameSpace as defaultNS in AerospikeMappingContext object but in new version defaultNameSpace is not present in AerospikeMappingContext. Please suggest if we can ignore setting defaultNameSpace in AerospikeMappingContext.

Below is the code for reference that I have implemented:

Older version code

CustomConversions conversions = new CustomConversions(Arrays.asList(StringToJava8LocalDateConverter.INSTANCE, Java8LocalDateToStringConverter.INSTANCE), AerospikeSimpleTypes.HOLDER);

AerospikeMappingContext mappingContext = new AerospikeMappingContext();


MappingAerospikeConverter converter = new MappingAerospikeConverter(mappingContext, conversions,new AerospikeTypeAliasAccessor(“type”));

New version Code

StoreConversions storeConversions = StoreConversions.of(AerospikeSimpleTypes.HOLDER,Collections.emptyList());

CustomConversions conversions = new CustomConversions(storeConversions, Arrays.asList(StringToJava8LocalDateConverter.INSTANCE, Java8LocalDateToStringConverter.INSTANCE));

MappingAerospikeConverter converter = new MappingAerospikeConverter(aerospikeMappingContext, conversions,new AerospikeTypeAliasAccessor(“type”));

I am not knowledgeable about Spring Data, but our resident expert suggests that you look at the example in our tests for how to add custom converters in the latest version.

For setting the default namespace, you can override the “nameSpace()” method in AerospikeDataConfigurationSupport class. An example can be found here.

Can you please also provide your entire configuration class as that would be helpful in understanding the problem? Thanks.