提交 70b3d015 编写于 作者: 如梦技术's avatar 如梦技术 🐛

mica-captcha 优化 bean 名称和添加 generateBase64Vo 方法。

上级 38b2f842
......@@ -6,6 +6,7 @@
- :sparkles: mica-metrics 重构 UndertowMetrics,暴露更加有用的指标。
- :sparkles: mica-metrics 完善 DruidMetrics,暴露更加有用的指标。
- :sparkles: mica-captcha 中的 cache 改为每次读取, caffeine 会刷新,照成引用为 null。
- :sparkles: mica-captcha 优化 bean 名称和添加 generateBase64Vo 方法。
- :sparkles: mica-logging 减少 reflections 日志,readme 添加阿里云、腾讯云日志服务接入链接。
- :sparkles: mica-core 添加网关通用 code。
- :sparkles: mica-core 添加 CollectionUtil computeIfAbsent 方法 避免 jdk8 下的 bugs JDK-8161372
......
......@@ -43,13 +43,13 @@ public class MicaCaptchaAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public Captcha captcha(MicaCaptchaProperties properties) {
public Captcha imageCaptcha(MicaCaptchaProperties properties) {
return new Captcha(properties.getCaptchaType());
}
@Bean
@ConditionalOnMissingBean
public ICaptchaService captchaService(MicaCaptchaProperties properties,
public ICaptchaService imageCaptchaService(MicaCaptchaProperties properties,
ICaptchaCache captchaCache,
Captcha captcha) {
return new CaptchaServiceImpl(properties, captchaCache, captcha);
......
......@@ -18,6 +18,7 @@ package net.dreamlu.mica.captcha.service;
import net.dreamlu.mica.captcha.vo.CaptchaVo;
import net.dreamlu.mica.core.utils.Base64Util;
import net.dreamlu.mica.core.utils.StringUtil;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
......@@ -77,6 +78,15 @@ public interface ICaptchaService {
return "data:image/jpeg;base64," + Base64Util.encodeToString(outputStream.toByteArray());
}
/**
* 生成验证码 base64 CaptchaVo
*
* @return CaptchaVo
*/
default CaptchaVo generateBase64Vo() {
return generateBase64Vo(StringUtil.getUUID());
}
/**
* 生成验证码 base64 CaptchaVo
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册