You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In pom.xml
spring-boot.version 2.0.6.RELEASE
spring-dynamodb-data-version 5.1.0
DynamoDBConfig.java
@Configuration
@EnableDynamoDBRepositories(dynamoDBMapperConfigRef = "dynamoDBMapperConfig",
basePackages = "... my packages here ...")
public class DynamoConfig {
@Value("${amazon.aws.accesskey}")
private String amazonAWSAccessKey;
@Value("${amazon.aws.secretkey}")
private String amazonAWSSecretKey;
@Value("${amazon.aws.dynamodb.tablename.prefix}")
private String tableNamePrefix;
@Bean
public AmazonDynamoDB amazonDynamoDB() {
return AmazonDynamoDBClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(amazonAWSAccessKey, amazonAWSSecretKey)))
.withRegion(Regions.DEFAULT_REGION).build();
}
@Bean
public DynamoDBMapperConfig dynamoDBMapperConfig(TableNameOverride tableNameOverrider) {
// Create empty DynamoDBMapperConfig builder
DynamoDBMapperConfig.Builder builder = DynamoDBMapperConfig.builder();
// Inject the table name overrider bean
builder.setTableNameOverride(tableNameOverrider);
// Sadly this is a @deprecated method but new DynamoDBMapperConfig.Builder() is incomplete compared to DynamoDBMapperConfig.DEFAULT
return new DynamoDBMapperConfig(DynamoDBMapperConfig.DEFAULT, builder.build());
}
@Bean
public TableNameOverride tableNameOverrider() {
return TableNameOverride.withTableNamePrefix( tableNamePrefix );
}
}
When running:
2019-02-12 17:05:19,007 [main ] WARN letWebServerApplicationContext 87 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serviceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repository': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dynamoDBMapperConfig' of bean class [org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactoryBean]: Bean property 'dynamoDBMapperConfig' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
"
The text was updated successfully, but these errors were encountered:
In pom.xml
spring-boot.version 2.0.6.RELEASE
spring-dynamodb-data-version 5.1.0
DynamoDBConfig.java
When running:
The text was updated successfully, but these errors were encountered: