1234567891011121314151617181920212223242526272829303132 |
- package io.renren.config;
- import com.google.code.kaptcha.impl.DefaultKaptcha;
- import com.google.code.kaptcha.util.Config;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import java.util.Properties;
- /**
- * 生成验证码配置
- *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-20 19:22
- */
- @Configuration
- public class KaptchaConfig {
- @Bean
- public DefaultKaptcha producer() {
- Properties properties = new Properties();
- properties.put("kaptcha.border", "no");
- properties.put("kaptcha.textproducer.font.color", "black");
- properties.put("kaptcha.textproducer.char.space", "5");
- Config config = new Config(properties);
- DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
- defaultKaptcha.setConfig(config);
- return defaultKaptcha;
- }
- }
|