Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add defaultBean qualifier for DynamoDbEnhancedClient synthetic beans #875

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void createClientBuilders(
if (syncClientRuntime != null) {
syntheticBean.produce(SyntheticBeanBuildItem
.configure(DynamoDbEnhancedClient.class)
.defaultBean()
.scope(ApplicationScoped.class)
.setRuntimeInit()
.createWith(recorder.createDynamoDbEnhancedClient(extensions))
Expand All @@ -147,6 +148,7 @@ void createClientBuilders(
if (asyncClientRuntime != null) {
syntheticBean.produce(SyntheticBeanBuildItem
.configure(DynamoDbEnhancedAsyncClient.class)
.defaultBean()
.scope(ApplicationScoped.class)
.setRuntimeInit()
.createWith(recorder.createDynamoDbEnhancedAsyncClient(extensions))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.quarkus.amazon.dynamodb.enhanced.deployment;

import jakarta.inject.Inject;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;

public class DynamoDbEnhancedClientAllowOverrideWithProducerTest {

@Inject
DynamoDbEnhancedClient client;

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClass(DynamoDbEnhancedClientProducer.class)
.addAsResource("full-config.properties", "application.properties"));

@Test
public void test() {
// should not fail
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.quarkus.amazon.dynamodb.enhanced.deployment;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;

import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

public class DynamoDbEnhancedClientProducer {

@Produces
@ApplicationScoped
public DynamoDbEnhancedClient enhancedClient(DynamoDbClient client) {
return DynamoDbEnhancedClient.builder()
.dynamoDbClient(client)
.build();
}

@Produces
@ApplicationScoped
public DynamoDbClient client() {
return DynamoDbClient.create();
}
}