Created
January 8, 2020 05:57
-
-
Save billydh/34b85545633fe44f537b17cd2200191b to your computer and use it in GitHub Desktop.
This file contains 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.beans.factory.annotation.Value | |
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(@Value("\${application.dynamo.region}") private val region: String, | |
@Value("\${application.dynamo.endpoint}") private val endpoint: String) { | |
@Bean | |
fun dynamoDbAsyncClient(): DynamoDbAsyncClient { | |
return DynamoDbAsyncClient.builder() | |
.region(Region.of(region)) | |
.endpointOverride(URI.create(endpoint)) | |
.credentialsProvider(DefaultCredentialsProvider.builder().build()) | |
.build() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment