31 lines
1017 B
Java
31 lines
1017 B
Java
package quant.rich.emoney.config;
|
|
|
|
import java.util.Properties;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.DependsOn;
|
|
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
|
import com.google.code.kaptcha.util.Config;
|
|
|
|
@Configuration
|
|
public class KaptchaConfig {
|
|
|
|
@Bean(name = "kaptchaProperties")
|
|
@ConfigurationProperties
|
|
Properties getKaptchaProperties() {
|
|
return new Properties();
|
|
}
|
|
|
|
@Bean
|
|
@DependsOn("kaptchaProperties")
|
|
DefaultKaptcha getDefaultKaptcha(@Autowired Properties kaptchaProperties) {
|
|
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
|
Config config = new Config(kaptchaProperties);
|
|
defaultKaptcha.setConfig(config);
|
|
|
|
return defaultKaptcha;
|
|
}
|
|
} |