content: package org.zeus;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
  import org.springframework.context.annotation.Bean;
  import org.zeus.common.validator.*;
  
  /**
   * @author: lizhizhong
   * CreatedDate: 2019/1/14.
   */
  //@Configuration
  public class ValidateCodeBeanConfig {
  
      @Autowired
      private SecurityProperties securityProperties;
  
      /**
       * 图片验证码图片生成器
       * @return
       */
      @Bean
      @ConditionalOnMissingBean(name = "imageValidateCodeGenerator")
      public ValidateCodeGenerator imageValidateCodeGenerator() {
          ImageCodeGenerator codeGenerator = new ImageCodeGenerator();
          codeGenerator.setSecurityProperties(securityProperties);
          return codeGenerator;
      }
  
      /**
       * 短信验证码发送器
       * @return
       */
      @Bean
      @ConditionalOnMissingBean(SmsCodeSender.class)
      public SmsCodeSender smsCodeSender() {
          return new DefaultSmsCodeSender();
      }
  
  }
  
  