some0neninja
some0neninja

Reputation: 13

DynamoDB in SpringBoot yml configuration file

I am trying to do auto creation tables in a local Dynamo DB. The problem is when I type these lines in the .yml configuration I am getting "Cannot resolve configuration property 'spring.data.dynamodb.entity2ddl.auto'" and the auto is highlited.

Application.yml file

spring:
  data:
    dynamodb:
      entity2ddl:
        auto: create-drop

In the pom.xml file I have these dependencies for aws:

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-dynamodb</artifactId>
        <version>1.11.857</version>
    </dependency>
    <dependency>
        <groupId>com.github.derjust</groupId>
        <artifactId>spring-data-dynamodb</artifactId>
        <version>5.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>

Upvotes: 0

Views: 1105

Answers (1)

Sobhan
Sobhan

Reputation: 1460

I have searched a little and based on the following answer:

https://stackoverflow.com/a/51157179/7189597

and the following Github repository:

https://github.com/derjust/spring-data-dynamodb/wiki/Autocreate-Tables

It is now available by using these properties in your property file:

spring.data.dynamodb.entity2ddl.auto = none
spring.data.dynamodb.entity2ddl.gsiProjectionType = ALL
spring.data.dynamodb.entity2ddl.readCapacity = 10
spring.data.dynamodb.entity2ddl.writeCapacity = 1

Also, other values are:

create-only, drop, create-drop, create, validate

Upvotes: 1

Related Questions