!206 [hotfix] 修复因生命周期,getCadThread = 0导致线程池创建失败问题

Merge pull request !206 from lujiaming/master
pull/209/MERGE
陈精华 2023-08-14 03:49:49 +00:00 committed by Gitee
commit b71442543d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 7 additions and 2 deletions

View File

@ -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());
}
/**
* ()
*