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

love.keeping.starter.web.config.KaptchaAutoConfiguration Maven / Gradle / Ivy

The newest version!
package love.keeping.starter.web.config;

import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.util.Config;
import love.keeping.starter.web.config.properties.KaptchaProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * 验证码配置
 *
 * @author Keeping
 */
@Configuration
@EnableConfigurationProperties(KaptchaProperties.class)
public class KaptchaAutoConfiguration {

  @Bean
  @Primary
  public Producer getProducer(KaptchaProperties properties) {

    Config config = new Config(properties.props());

    return config.getProducerImpl();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy