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

org.zodiac.autoconfigure.sms.PlatformSmsTencentAutoConfiguration 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.zodiac.commons.util.Func;

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.TencentSmsTemplate.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_TENCENT)
public class PlatformSmsTencentAutoConfiguration {

    private final org.zodiac.redis.RedisDataOperation redisDataOperation;

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

    @Bean
    @ConditionalOnMissingBean
    protected org.zodiac.sms.TencentSmsTemplate tencentSmsTemplate(PlatformSmsProperties plartformSmsProperties) {
        com.github.qcloudsms.SmsMultiSender smsSender =
            new com.github.qcloudsms.SmsMultiSender(Func.toInt(plartformSmsProperties.getAccessKey()), plartformSmsProperties.getSecretKey());
        return new org.zodiac.sms.TencentSmsTemplate(plartformSmsProperties, smsSender, redisDataOperation);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy