Skip to content

Commit

Permalink
FMWK-567 Update configuration (#781)
Browse files Browse the repository at this point in the history
* Update configuration properties prefix
* Add bean names
  • Loading branch information
agrgr authored Sep 30, 2024
1 parent f3e7d0c commit 8394cf8
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public QueryEngine queryEngine(IAerospikeClient aerospikeClient,
return queryEngine;
}

@Bean
@Bean(name = "aerospikePersistenceEntityIndexCreator")
public AerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCreator(
ObjectProvider<AerospikeMappingContext> aerospikeMappingContext,
AerospikeIndexResolver aerospikeIndexResolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ protected ClientPolicy getClientPolicy() {
return clientPolicy;
}

@Bean
public ReactiveAerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCreator(
@Bean(name = "reactiveAerospikePersistenceEntityIndexCreator")
public ReactiveAerospikePersistenceEntityIndexCreator reactiveAerospikePersistenceEntityIndexCreator(
ObjectProvider<AerospikeMappingContext> aerospikeMappingContext,
AerospikeIndexResolver aerospikeIndexResolver,
ObjectProvider<ReactiveAerospikeTemplate> template, AerospikeSettings settings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
import com.aerospike.client.Host;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import static org.springframework.data.aerospike.config.AerospikeDataConfigurationSupport.CONFIG_PREFIX_CONNECTION;

@Setter
@Getter
@ConfigurationProperties(prefix = CONFIG_PREFIX_CONNECTION)
public class AerospikeConnectionSettings {

// String of hosts separated by ',' in form of hostname1[:tlsName1]:port1,...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import io.netty.channel.nio.NioEventLoopGroup;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -71,9 +70,9 @@
@Configuration
public abstract class AerospikeDataConfigurationSupport {

protected static final String CONFIG_PREFIX = "spring-data-aerospike";
protected static final String CONFIG_PREFIX_DATA = CONFIG_PREFIX + ".data";
protected static final String CONFIG_PREFIX_CONNECTION = CONFIG_PREFIX + ".connection";
public static final String CONFIG_PREFIX = "spring.aerospike";
public static final String CONFIG_PREFIX_DATA = CONFIG_PREFIX + ".data";
public static final String CONFIG_PREFIX_CONNECTION = CONFIG_PREFIX + ".connection";

@Bean(name = "aerospikeStatementBuilder")
public StatementBuilder statementBuilder(IndexesCache indexesCache) {
Expand Down Expand Up @@ -267,13 +266,11 @@ protected ClientPolicy getClientPolicy() {
}

@Bean
@ConfigurationProperties(prefix = CONFIG_PREFIX_DATA)
public AerospikeDataSettings readAerospikeDataSettings() {
return new AerospikeDataSettings();
}

@Bean
@ConfigurationProperties(prefix = CONFIG_PREFIX_CONNECTION)
public AerospikeConnectionSettings readAerospikeSettings() {
return new AerospikeConnectionSettings();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import static org.springframework.data.aerospike.config.AerospikeDataConfigurationSupport.CONFIG_PREFIX_DATA;

@Setter
@Getter
@ConfigurationProperties(prefix = CONFIG_PREFIX_DATA)
public class AerospikeDataSettings {

// Enable scan operation
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spring-data-aerospike.connection.hosts=localhost:3000
spring-data-aerospike.connection.namespace=test
spring-data-aerospike.data.scans-enabled=false
spring-data-aerospike.data.create-indexes-on-startup=true
spring-data-aerospike.data.index-cache-refresh-seconds=3600
spring-data-aerospike.data.server-version-refresh-seconds=3600
spring-data-aerospike.data.query-max-records=10000
spring-data-aerospike.data.batch-write-size=100
spring-data-aerospike.data.keep-original-key-types=false
spring.aerospike.connection.hosts=localhost:3000
spring.aerospike.connection.namespace=test
spring.aerospike.data.scans-enabled=false
spring.aerospike.data.create-indexes-on-startup=true
spring.aerospike.data.index-cache-refresh-seconds=3600
spring.aerospike.data.server-version-refresh-seconds=3600
spring.aerospike.data.query-max-records=10000
spring.aerospike.data.batch-write-size=100
spring.aerospike.data.keep-original-key-types=false
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public abstract class BaseIntegrationTests {
public static final String DIFFERENT_EXISTING_CACHE = "DIFFERENT-EXISTING-CACHE";
protected static final int MILLIS_TO_NANO = 1_000_000;

@Value("${spring-data-aerospike.connection.namespace}")
@Value("${spring.aerospike.connection.namespace}")
protected String namespace;

protected String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@EnableAutoConfiguration
public class CommonTestConfig {

@Value("${spring-data-aerospike.connection.namespace}")
@Value("${spring.aerospike.connection.namespace}")
protected String namespace;

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@Slf4j
@ContextConfiguration
@TestPropertySource(properties = {"spring-data-aerospike.data.server-version-refresh-seconds = 0"})
@TestPropertySource(properties = {"spring.aerospike.data.server-version-refresh-seconds = 0"})
public class IndexNotScheduledCacheRefreshTest extends BaseBlockingIntegrationTests {

String setName = "scheduled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@Slf4j
@ContextConfiguration
@TestPropertySource(properties = {"spring-data-aerospike.data.index-cache-refresh-seconds=4"})
@TestPropertySource(properties = {"spring.aerospike.data.index-cache-refresh-seconds=4"})
public class IndexScheduledCacheRefreshTest extends BaseBlockingIntegrationTests {

String setName = "scheduled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

@TestPropertySource(properties = {"spring-data-aerospike.data.create-indexes-on-startup=true"})
@TestPropertySource(properties = {"spring.aerospike.data.create-indexes-on-startup=true"})
// this test class requires secondary indexes created on startup
public class IndexedAnnotationTests extends BaseBlockingIntegrationTests {

Expand Down
18 changes: 9 additions & 9 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spring-data-aerospike.connection.hosts=${embedded.aerospike.host}:${embedded.aerospike.port}
spring-data-aerospike.connection.namespace=${embedded.aerospike.namespace}
spring-data-aerospike.data.scans-enabled=true
spring-data-aerospike.data.create-indexes-on-startup=false
spring-data-aerospike.data.index-cache-refresh-seconds=0
spring-data-aerospike.data.server-version-refresh-seconds=0
spring-data-aerospike.data.query-max-records=5000
spring-data-aerospike.data.batch-write-size=100
spring-data-aerospike.data.keep-original-key-types=false
spring.aerospike.connection.hosts=${embedded.aerospike.host}:${embedded.aerospike.port}
spring.aerospike.connection.namespace=${embedded.aerospike.namespace}
spring.aerospike.data.scans-enabled=true
spring.aerospike.data.create-indexes-on-startup=false
spring.aerospike.data.index-cache-refresh-seconds=0
spring.aerospike.data.server-version-refresh-seconds=0
spring.aerospike.data.query-max-records=5000
spring.aerospike.data.batch-write-size=100
spring.aerospike.data.keep-original-key-types=false

0 comments on commit 8394cf8

Please sign in to comment.