-
Notifications
You must be signed in to change notification settings - Fork 141
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
Second instance of DynamoDBMapperConfig being created #233
Comments
I had the same problem and I found out that I was configuring another DynamoDBMapperConfig bean. So I removed this extra bean and the error stopped, remaining only the Best regards, Tiago Peixoto. |
Yes, but I need to configure the DynamoDBMapperConfig to specify table name overrides. The |
Have you tried to set For exemple (in Kotlin):
|
Yes. And works fine in 5.0.4. @Configuration
@EnableDynamoDBRepositories(dynamoDBMapperConfigRef = "dynamoDBMapperConfig")
public class DynamoDBConfig {
@Bean("dynamoDBMapperConfig")
public DynamoDBMapperConfig dynamoDBMapperConfig(final TableNameOverride tableNameOverrider) { |
A quick looking around the code, it looks like DynamoDBMapperConfigFactory was added in 5.1.0, as a FactoryBean which Spring Boot is picking up. Unfortunately since I've got it working with 5.0.4 I don't have the spare time (project manager is happy with older version working) to go back and work out the appropriate config to override the FactoryBean to use my own settings. |
I ran into this same problem in Spring Boot, but didn't have to override the factory bean, I just removed the ConfigRef from the @EnabledDynamoDBRepositories annotation. If you have a DynamoDBMapperConfig bean the postProcessAfterInitialization method in the DynamoDBMapperConfigFactory will find it and use it. Have you tried changing |
…re registering its factory)
I created a PR. Hope it helps! Feel free to give me feedback. |
I made a new fix related to this issue. |
Any ETA on this? We'd been waiting for 5.1 to go to Spring Boot 2.1, but now we'll need to wait for this fix as well. |
I figured out a couple ways to get around this until the next release. First, when you are creating your Second, and not as good, in my opinion, use |
Hi, just to make it clear: I tried this library v5.1 following step by step the tutorial and I've the exception reported above:
I do not have a multiple dynamoDBMapperConfig, I'm just using the basic configuration. Should I move back to the previous version? I'm using Spring Boot 2.1.4 Thanks |
@emckissick's suggestion worked for us. I'm not sure if there are any other possible pitfalls to using this approach, but simply removing the Example: @Configuration
@ConfigurationProperties("amazon.aws")
@Setter
@EnableDynamoDBRepositories(basePackages = "com.package.adapters.dynamodb")
public class PersistenceConfig {
@NotBlank
private String accessKey;
@NotBlank
private String secretKey;
@Bean
public AmazonDynamoDB amazonDynamoDB() {
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AWSStaticCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
return AmazonDynamoDBClientBuilder
.standard()
.withCredentials(credentialsProvider)
.build();
}
@Bean
public DynamoDBMapperConfig dynamoDBMapperConfig() {
return new DynamoDBMapperConfig.Builder()
.withTableNameOverride(withTableNamePrefix("local."))
.build();
}
} |
Like others, I already had a For me a combination of removing |
…nfigExtension conflicts)
The following does the trick for me. Primary annotation and the removal of dynamoDBMapperConfigRef
|
In updating to 5.1.0, on startup we're now getting:
We're creating the DynamoDBMapperConfig as per https://github.com/derjust/spring-data-dynamodb/wiki/Alter-table-name-during-runtime.
Looks like something else is also now creating a DynamoDBMapperConfig.
Should these be created now in a different fashion?
The text was updated successfully, but these errors were encountered: