fix:修复打包启动报错

This commit is contained in:
zhangzq
2024-07-25 16:31:23 +08:00
parent 062c05b2d4
commit 486639cc2f
5 changed files with 7 additions and 21 deletions

View File

@@ -43,11 +43,6 @@ public class AppRun implements CommandLineRunner {
System.out.println("--------项目启动完成--------");
}
// @Bean
// public SpringContextHolder springContextHolder() {
// return new SpringContextHolder();
// }
/*@Bean
public ServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();

View File

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -19,7 +20,7 @@ import java.util.Map;
* @Date 2024/2/2 10:39
*/
@Slf4j
@Service
@Component
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
private static ApplicationContext applicationContext = null;
@@ -43,11 +44,6 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
}
}
public static ApplicationContext getApplicationContext() {
try {
} catch (Exception e) {
e.printStackTrace();
}
return applicationContext;
}
@@ -136,6 +132,7 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
log.warn("自动注入bean工具");
if (SpringContextHolder.applicationContext != null) {
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
}

View File

@@ -13,7 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.istack.internal.NotNull;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.utils.CopyUtil;
@@ -74,7 +73,6 @@ public class BmClassStandardServiceImpl extends ServiceImpl<BmClassStandardMappe
return result;
}
@NotNull
private List<Map> getMaps(List<Map<String, Object>> list) {
List<Map> result = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {

View File

@@ -23,6 +23,8 @@ public abstract class Decisioner<T,P> implements InitializingBean {
public StStrategyConfig strategyConfig;
@Autowired
private IStStrategyConfigService iStStrategyConfigService;
@Autowired
private SpringContextHolder springContextHolder;
public abstract List<T> handler(List<T> list, P param);

View File

@@ -16,6 +16,7 @@ import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
import org.slf4j.MDC;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -25,15 +26,8 @@ import java.util.List;
* @Date 2024/5/6 14:53
*/
@Service
public class WmsToAcsService implements InitializingBean {
public class WmsToAcsService{
private SyncFormMapping mapping;
@Override
public void afterPropertiesSet(){
this.mapping = SpringContextHolder.getBean(ISyncFormMappingService.class).getOne(new QueryWrapper<SyncFormMapping>()
.eq("form_type","sch_base_task"));
}
public TableDataInfo changeMode(String deviceCode,String type,String mode){
InteracteDto dto = InteracteDto.builder().service("wmsToAcsService")