
这个是我的方法所在的模块的配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byName" default-lazy-init="true">
这个是Biz层的配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
这个是dao层的配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
其他方法都没有问题。但是就是当调用多个接口的时候出现错误
出错方法如下:
@Component
public class EsbExcelHandler {
private static EsbExcelHandler excelHandler = new EsbExcelHandler();
private int flag = 0;//用于标识
@Autowired
private SoaCfgMessageControlMapper soaCfgMessageControlMapper;
@Autowired
private SoaCfgMessageListMapper soaCfgMessageListMapper;
@Autowired
private SoaCfgServListMapper soaCfgServListMapper;
@Autowired
private SoaCfgMessageMetaDataMapper soaCfgMessageMetaDataMapper;
@Autowired
private SoaCfgMessageStructureMapper soaCfgMessageStructureMapper;
public int importMsgHeaderExcel(File file) {
try {
int res = parseMsgHeaderExcel(file);
if(res>0){
flag = 1;
return flag;
}
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
public int parseMsgHeaderExcel(File importFile) throws Exception {
//....解析文件代码省略
// 报文头对象
List listMsgCtrl = new ArrayList();
// 报文字段表
List listmetaData = new ArrayList();
SoaCfgMessageControl msgCtrl = new SoaCfgMessageControl();
SoaCfgMessageMetaData metaData = new SoaCfgMessageMetaData();
//取出appsSysId
for(int i = 0;i
exampleMsgCtrl.createCriteria().andAppsSysIdEqualTo(appsSysId);
try{
if(exampleMsgCtrl != null){
int ctrlRes =soaCfgMessageControlMapper.countByExample(exampleMsgCtrl);//出错。
System.out.println("一共有:"+ctrlRes+"条记录");
}
}catch(Exception e){
flag = 0;
System.out.println("请检查数据库连接或者sql语句,导入操作失败!!!");
e.printStackTrace();
}
}
return flag;
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
把你的配置po上来,理论上你单个接口可以正常调用,多个也不会报错
Mapper接口你使用bean注解了吗,比如@Service 或者 @Component ?
看了下你贴出的配置,没有找到你spring 扫描包的配置,可以加上这个试试
<context:component-scan base-package="com.ibs.clearing"/>