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

com.github.xiaoyuge5201.config.AliYunSMSAutoConfiguration Maven / Gradle / Ivy

The newest version!
package com.github.xiaoyuge5201.config;

import com.github.xiaoyuge5201.component.AliYunSmsClient;
import com.github.xiaoyuge5201.props.AliYunSMSProperties;
import com.google.gson.Gson;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yugb
 */
@Configuration
@ConditionalOnWebApplication
@ConditionalOnProperty(name = "sms.aliyun.enable")
@EnableConfigurationProperties(AliYunSMSProperties.class)
public class AliYunSMSAutoConfiguration {

    /**
     * 依赖注入属性
     *
     * @param properties
     * @return
     */
    @Bean
    public AliYunSmsClient aliYunSmsClient(Gson gson, AliYunSMSProperties properties) {
        AliYunSmsClient aliYunSmsClient = new AliYunSmsClient(gson, properties);
        return aliYunSmsClient;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy