fuint-framework/fuint-component/src/main/java/com/fuint/config/ComponentConfiguration.java

(完整代码) 1KB

package com.fuint.config;

import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.InputStream;
import java.util.Properties;

/**
 * 组件配置
 * <p/>
 * Created by FSQ
 * Contact wx fsq_better
 */
@Configuration
public class ComponentConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(ComponentConfiguration.class);

    /**
     * 验证码
     */
    @Bean
    public DefaultKaptcha defaultKaptcha() {
        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
        Properties property = new Properties();
        try {
            InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("captcha-conf.properties");
            property.load(inputStream);
            Config config = new Config(property);
            defaultKaptcha.setConfig(config);
        } catch (Exception e) {
            logger.error("Kaptcha properties load error {}", e);
            throw new RuntimeException("Kaptcha properties load error");
        }
        return defaultKaptcha;
    }


}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。