| 123456789101112131415161718192021222324252627282930 |
- package com.ydtech.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 Yasepix
- * @date Oct 29, 2018
- */
- @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", "4");
- Config config = new Config(properties);
- DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
- defaultKaptcha.setConfig(config);
- return defaultKaptcha;
- }
- }
|