From 4a0409953aef808820000bd62bed4f5d9a8f9e85 Mon Sep 17 00:00:00 2001 From: lujiaming Date: Fri, 11 Aug 2023 19:19:55 +0800 Subject: [PATCH] =?UTF-8?q?[hotfix]=20=E4=BF=AE=E5=A4=8D=E5=9B=A0=E7=94=9F?= =?UTF-8?q?=E5=91=BD=E5=91=A8=E6=9C=9F=EF=BC=8CgetCadThread=20=3D=200?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=BA=BF=E7=A8=8B=E6=B1=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/keking/service/FileHandlerService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/cn/keking/service/FileHandlerService.java b/server/src/main/java/cn/keking/service/FileHandlerService.java index b10cd3c2..15008b37 100644 --- a/server/src/main/java/cn/keking/service/FileHandlerService.java +++ b/server/src/main/java/cn/keking/service/FileHandlerService.java @@ -25,6 +25,7 @@ import org.apache.pdfbox.tools.imageio.ImageIOUtil; import org.apache.poi.EncryptedDocumentException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -48,7 +49,7 @@ import java.util.stream.IntStream; * @date 2017/11/13 */ @Component -public class FileHandlerService { +public class FileHandlerService implements InitializingBean { private static final String PDF2JPG_IMAGE_FORMAT = ".jpg"; private static final String PDF_PASSWORD_MSG = "password"; @@ -148,7 +149,11 @@ public class FileHandlerService { /** cad定义线程池 */ - private static final ExecutorService pool = Executors.newFixedThreadPool(ConfigConstants.getCadThread()); + private ExecutorService pool = null; + @Override + public void afterPropertiesSet() throws Exception { + pool = Executors.newFixedThreadPool(ConfigConstants.getCadThread()); + } /** * 对转换后的文件进行操作(改变编码方式) *