spring-projects/spring-aot-smoke-tests

Spring data aerospike native graalvm

ijusti opened this issue · 1 comments

As aerospike spring data use lazy initialization and native image does not support CGLIB you need to override bean aerospikePersistenceEntityIndexCreator. Using secondary indexes will not work, but actually they work bad.

@Bean
   public BaseAerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCreator(
       AerospikeDataProperties aerospikeDataProperties,
       ObjectProvider<AerospikeMappingContext> aerospikeMappingContext,
       AerospikeIndexResolver aerospikeIndexResolver) {
       return new BaseAerospikePersistenceEntityIndexCreator(aerospikeMappingContext, aerospikeDataProperties.isCreateIndexesOnStartup(), aerospikeIndexResolver){

           @Override
           protected void installIndexes(Set<AerospikeIndexDefinition> indexes) {
               log.warn("Secondary indexes  were not created: {}", indexes);
           }
       };
   }

Also, main properties required to inject aerospike beans to native.

spring.aerospike.hosts: localhost:3000
spring.data.aerospike.namespace: TEST

This repository is for smoke testing of AOT and native image support that's maintained by the Spring team. Spring Data Aerospike is a third-party project so issues about it do not belong here.