This commit is contained in:
雷欧(林平凡)
2025-06-16 16:36:25 +08:00
parent 98204bb9f9
commit 2e4128ab40
22 changed files with 757 additions and 38 deletions

View File

@@ -0,0 +1,27 @@
package cn.van.business.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;
@Configuration
public class KaptchaConfig {
@Bean
public DefaultKaptcha kaptchaProducer() {
DefaultKaptcha kaptcha = new DefaultKaptcha();
Properties properties = new Properties();
// 设置验证码参数
properties.setProperty("kaptcha.image.width", "150");
properties.setProperty("kaptcha.image.height", "50");
properties.setProperty("kaptcha.textproducer.char.string", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
properties.setProperty("kaptcha.textproducer.char.length", "4");
kaptcha.setConfig(new Config(properties));
return kaptcha;
}
}