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

org.zodiac.autoconfigure.sms.PlatformSmsYunpianAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.sms;

import org.zodiac.autoconfigure.redis.RedisTemplateAutoConfiguration;
import org.zodiac.autoconfigure.sms.condition.ConditionalOnPlatformSms;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

@SpringBootConfiguration
@ConditionalOnPlatformSms
@AutoConfigureAfter(value = {RedisTemplateAutoConfiguration.class})
@ConditionalOnClass(value = {com.github.qcloudsms.SmsMultiSender.class, org.zodiac.sms.YunpianSmsTemplate.class, org.zodiac.redis.RedisDataOperation.class})
@ConditionalOnProperty(value = org.zodiac.sms.constants.PlatformSmsSystemPropertiesConstants.PLATFORM_SMS_NAME, havingValue = org.zodiac.sms.constants.PlatformSmsConstants.PLATFORM_SMS_VENDOR_YUNPIAN)
public class PlatformSmsYunpianAutoConfiguration {

    private final org.zodiac.redis.RedisDataOperation redisDataOperation;

    public PlatformSmsYunpianAutoConfiguration(org.zodiac.redis.RedisDataOperation redisDataOperation) {
        this.redisDataOperation = redisDataOperation;
    }

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.sms.YunpianSmsTemplate yunpianSmsTemplate(PlatformSmsProperties plartformSmsProperties) {
        com.yunpian.sdk.YunpianClient client = new com.yunpian.sdk.YunpianClient(plartformSmsProperties.getAccessKey()).init();
        return new org.zodiac.sms.YunpianSmsTemplate(plartformSmsProperties, client, redisDataOperation);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy