All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.jpomykala.starters.springhoc.mail.AmazonSesAutoConfiguration Maven / Gradle / Ivy

package me.jpomykala.starters.springhoc.mail;

import com.amazonaws.services.simpleemail.AmazonSimpleEmailService;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder;
import me.jpomykala.starters.springhoc.AmazonProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(AmazonProperties.class)
public class AmazonSesAutoConfiguration {

  private final AmazonProperties properties;

  @Autowired
  public AmazonSesAutoConfiguration(AmazonProperties properties) {
    this.properties = properties;
  }

  @Bean
  @ConditionalOnMissingBean
  public AmazonSimpleEmailService amazonSimpleEmailService() {
    return AmazonSimpleEmailServiceClientBuilder.standard()
            .withCredentials(properties.getAWSCredentials())
            .withRegion(properties.getRegions())
            .build();
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy