derjust / spring-data-dynamodb

This module deals with enhanced support for a data access layer built on AWS DynamoDB.
https://derjust.github.io/spring-data-dynamodb/
Apache License 2.0
402 stars 141 forks source link

Is multiples repositories allowed ? [Junit4] #269

Open tanguc opened 4 years ago

tanguc commented 4 years ago

Expected Behavior

Able to create multiples repositories where each of them represents a table

Actual Behavior

Only one repository is created instead of N

Steps to Reproduce the Problem

1.Create two repositories in the same package 1.EnableDynamodbScan on the package 1.Run

Specifications

11:29:49.000 [Test worker] INFO DynamoDBRepositoryFactory - Spring Data DynamoDB Version: 5.1.0 (2.1) 11:29:49.000 [Test worker] INFO DynamoDBRepositoryFactory - Spring Data Version: 2.1.10.RELEASE 11:29:49.000 [Test worker] INFO DynamoDBRepositoryFactory - AWS SDK Version: 1.11.600 11:29:49.000 [Test worker] INFO DynamoDBRepositoryFactory - Java Version: 1.8.0_222 - OpenJDK 64-Bit Server VM 25.222-b10 11:29:49.000 [Test worker] INFO DynamoDBRepositoryFactory - Platform Details: Linux 5.0.0-32-generic

Details: When I'm trying to create multiple repositories with each of them have their unique model entities I'm getting only one table created. After analysis the bean definitions is triggered by the beanRepositoryRegistrar(SpringBoot) however in the Entity2DynamoDBTAblesSynchronizer only one is detected in the registered entities: In the log: Checking repository classes with DynamoDB tables Session for ContextRefreshedEvent I'm using Junit4

GabrielOancea commented 4 years ago

Similar and related issue: I have 2 DynamoDB tables that I need to access from the same application. I have two entity classes and two repository classes. It builds OK, but when I try to run I get a bean error from Spring Boot: "The bean 'dynamoDB-DynamoDBMapperConfig' could not be registered. A bean with that name has already been defined and overriding is disabled." The only solution was to allow bean overriding.