diff --git a/boot-service/src/main/java/com/xwbing/util/QRCodeUtils.java b/boot-service/src/main/java/com/xwbing/util/QRCodeUtils.java index 4021fb6..6149912 100644 --- a/boot-service/src/main/java/com/xwbing/util/QRCodeUtils.java +++ b/boot-service/src/main/java/com/xwbing/util/QRCodeUtils.java @@ -10,6 +10,7 @@ import com.xwbing.exception.UtilException; import org.apache.commons.io.output.ByteArrayOutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.io.ClassPathResource; import javax.imageio.ImageIO; import java.awt.*; @@ -295,10 +296,12 @@ public class QRCodeUtils { // String tomcatHome = System.getProperty("catalina.home"); // String name="QRcode"; // File output=new File(tomcatHome+File.separator+"file"+File.separator+name+".png"); - File image = new File("C:/Users/ThinkPad/Desktop/xwbing.png"); + ClassPathResource file = new ClassPathResource("file"); + String path = file.getFile().getAbsolutePath(); + File image = new File(path+File.separator+"logo.png"); FileInputStream logo=new FileInputStream(image); - File out = new File("C:/Users/ThinkPad/Desktop/bbb.png"); - createCodeLogo(out,"aaaa",logo,""); + File out = new File(path+File.separator+"QRCode.png"); + createCodeLogo(out,"java生成的二維碼",logo,""); } } diff --git a/boot-service/src/main/resources/file/0000001.png b/boot-service/src/main/resources/file/QRCode.png similarity index 100% rename from boot-service/src/main/resources/file/0000001.png rename to boot-service/src/main/resources/file/QRCode.png diff --git a/boot-service/src/main/resources/file/logo.png b/boot-service/src/main/resources/file/logo.png new file mode 100644 index 0000000..e63f562 Binary files /dev/null and b/boot-service/src/main/resources/file/logo.png differ diff --git a/boot-web/src/main/resources/file/0000001.png b/boot-web/src/main/resources/file/QRCode.png similarity index 100% rename from boot-web/src/main/resources/file/0000001.png rename to boot-web/src/main/resources/file/QRCode.png