Created
January 15, 2020 11:47
-
-
Save billydh/8bdab0255c1f41a26cef5ee0979902d7 to your computer and use it in GitHub Desktop.
DynamoClientProperties using DynamoConfigProperties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.codebrews.dynamodemo | |
| import org.springframework.context.annotation.Bean | |
| import org.springframework.context.annotation.Configuration | |
| import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider | |
| import software.amazon.awssdk.regions.Region | |
| import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient | |
| import java.net.URI | |
| @Configuration | |
| class DynamoClientProperties(private val dynamoConfigProperties: DynamoConfigProperties) { | |
| @Bean | |
| fun dynamoDbAsyncClient(): DynamoDbAsyncClient { | |
| return DynamoDbAsyncClient.builder() | |
| .region(Region.of(dynamoConfigProperties.region)) | |
| .endpointOverride(URI.create(dynamoConfigProperties.endpoint)) | |
| .credentialsProvider(DefaultCredentialsProvider.builder().build()) | |
| .build() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment