|
|
@@ -2,7 +2,10 @@ package com.zksy.system.utils;
|
|
|
|
|
|
import com.zksy.system.basicData.domain.Captcha;
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
import javax.imageio.ImageIO;
|
|
|
import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
@@ -14,6 +17,7 @@ import java.util.Base64;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Random;
|
|
|
|
|
|
+@Component
|
|
|
public class CaptchaUtils {
|
|
|
|
|
|
/**
|
|
|
@@ -24,8 +28,15 @@ public class CaptchaUtils {
|
|
|
/**
|
|
|
* 本地图片地址
|
|
|
**/
|
|
|
- private final static String IMG_PATH = "D:/Temp/%s.jpg";
|
|
|
+
|
|
|
+ private static String IMG_PATH;
|
|
|
+ @Value("${imgAddress}")
|
|
|
+ private String imgUrl;
|
|
|
private static int usedImgNumber;
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ IMG_PATH = this.imgUrl;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 入参校验设置默认值
|