spring-cloud-aws
spring-cloud-aws copied to clipboard
Expand use of DynamoDB table prefix in auto-configuration
Type: Feature
Is your feature request related to a problem? Please describe.
The resolution to the #725 issue (#726) did a good job of addressing the missing table-prefix property, but it over-indexed on making use of the DynamoDbTemplate
more convenient and missed an easy opportunity to expand the influence of this new property.
Describe the solution you'd like
I feel like utilizing something like the code below in the DynamoDbAutoConfiguration
would optimize the number of auto-configuration opportunities (beyond DynamoDbTemplate
):
@ConditionalOnMissingBean
@Bean
public DynamoDbTableNameResolver dynamoDbTableNameResolver(DynamoDbProperties properties) {
return new DefaultDynamoDbTableNameResolver(properties.getTablePrefix());
}
Describe alternatives you've considered
An alternative I considered was calling DynamoDbProperties.getTablePrefix()
from inside of a DefaultDynamoDbTableNameResolver
, but this does not fit the pattern used for other Spring beans within this project.
Additional context n/a
Thanks @acollins4-chwy . @MatejNedic @maciejwalkowiak what would be your thoughts.
I am not sure if i get it. You can confiure custom DynamoDbTablenameResolver
bean and it will be picked up by auto-config. See: https://github.com/awspring/spring-cloud-aws/blob/main/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/dynamodb/DynamoDbAutoConfiguration.java#L120
@maciejwalkowiak, the custom configuration is what I'm aiming to avoid here. It's a minor change, but, if the bean exists here, then no one else needs to make a custom version of it. You see what I mean?
Hey @acollins4-chwy, this would be breaking change. I agree with @maciejwalkowiak that this can be done manually by creating a custom bean. I don't think we should be this specific for use cases that dont use dynamodbTemplate
Hey @MatejNedic. Thanks for the reply. Do you mind explaining what this would break?
the benefit of this change is that the return type of the method is the interface rather than the class, right?