Skip to content

Commit

Permalink
ability to register extensions (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr authored May 7, 2024
1 parent 6a4e588 commit 850f65c
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
import io.micronaut.context.annotation.Factory;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClientExtension;
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

import jakarta.inject.Singleton;

import java.util.List;

/**
* Factory class which provides
* {@link software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbEnhancedClient} and
Expand All @@ -36,14 +39,14 @@ public class DynamoDBEnhancedClientsFactory {

@Bean
@Singleton
public DynamoDbEnhancedClient dynamoDbEnhancedClient(DynamoDbClient dynamoDbClient) {
return DynamoDbEnhancedClient.builder().dynamoDbClient(dynamoDbClient).build();
public DynamoDbEnhancedClient dynamoDbEnhancedClient(DynamoDbClient dynamoDbClient, List<DynamoDbEnhancedClientExtension> extensions) {
return DynamoDbEnhancedClient.builder().dynamoDbClient(dynamoDbClient).extensions(extensions).build();
}

@Bean
@Singleton
public DynamoDbEnhancedAsyncClient dynamoDbEnhancedAsyncClient(DynamoDbAsyncClient dynamoDbAsyncClient) {
return DynamoDbEnhancedAsyncClient.builder().dynamoDbClient(dynamoDbAsyncClient).build();
public DynamoDbEnhancedAsyncClient dynamoDbEnhancedAsyncClient(DynamoDbAsyncClient dynamoDbAsyncClient, List<DynamoDbEnhancedClientExtension> extensions) {
return DynamoDbEnhancedAsyncClient.builder().dynamoDbClient(dynamoDbAsyncClient).extensions(extensions).build();
}

}

0 comments on commit 850f65c

Please sign in to comment.