fix(ES连接报错修复): 修复ES未连接时启动报错问题

This commit is contained in:
MAC 2022-01-13 23:00:28 +08:00
parent f4ed0aa5a5
commit 477f336b69
4 changed files with 12 additions and 4 deletions

View File

@ -1,8 +1,10 @@
package com.qiwenshare.file.api; package com.qiwenshare.file.api;
import com.qiwenshare.file.config.es.FileSearch; import com.qiwenshare.file.config.es.FileSearch;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
@Lazy
public interface IElasticSearchService extends ElasticsearchRepository<FileSearch,Long> { public interface IElasticSearchService extends ElasticsearchRepository<FileSearch,Long> {
} }

View File

@ -14,6 +14,8 @@ import com.qiwenshare.ufop.factory.UFOPFactory;
import com.qiwenshare.ufop.util.UFOPUtils; import com.qiwenshare.ufop.util.UFOPUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -42,10 +44,9 @@ public class FileDealComp {
IShareFileService shareFileService; IShareFileService shareFileService;
@Resource @Resource
IUserFileService userFileService; IUserFileService userFileService;
@Resource
UFOPFactory ufopFactory;
@Resource @Autowired
@Lazy
private IElasticSearchService elasticSearchService; private IElasticSearchService elasticSearchService;
public static Executor exec = Executors.newFixedThreadPool(10); public static Executor exec = Executors.newFixedThreadPool(10);

View File

@ -6,6 +6,7 @@ import com.qiwenshare.file.domain.UserFile;
import com.qiwenshare.file.service.UserFileService; import com.qiwenshare.file.service.UserFileService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -19,6 +20,7 @@ public class TaskController {
@Resource @Resource
UserFileService userFileService; UserFileService userFileService;
@Autowired @Autowired
@Lazy
private IElasticSearchService elasticSearchService; private IElasticSearchService elasticSearchService;
@Resource @Resource
FileDealComp fileDealComp; FileDealComp fileDealComp;

View File

@ -1,5 +1,8 @@
server.port=8080 server.port=8080
#环境切换 dev/prod
spring.profiles.active=dev spring.profiles.active=dev
eureka.client.register-with-eureka=false eureka.client.register-with-eureka=false
eureka.client.fetchRegistry=false eureka.client.fetchRegistry=false
#eureka.client.server.waitTimeInMsWhenSyncEmpty=0 #eureka.client.server.waitTimeInMsWhenSyncEmpty=0
@ -127,6 +130,6 @@ jwt.payload.registerd-claims.aud = qiwenshare
qiwen.file.version=1.1.2 qiwen.file.version=1.1.2
# 当前部署外网IP用于office预览 # 当前部署外网IP用于office预览
deployment.host=192.168.31.158 deployment.host=192.168.1.6