JDK11单元测试-无法读取外部 DTD

本文探讨了在Spring Boot项目中遇到的单元测试期间,由于不允许访问外部DTD而引发的MyBatis报错。通过配置jaxp.properties解决访问权限问题,以及针对不同JDK版本的处理策略,最终确定为单元测试环境差异导致。

项目紧张的时候,大部分单元测试都是后期补充的,最近一个客户管理中心的项目进行时发现一个报错

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘customerService’: Unsatisfied dependency expressed through field ‘baseMapper’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘crmCustomerMapper’ defined in file [C:\Users\hamish-wu\IdeaProjects\wk_crm_single\crm\target\classes\com\kakarote\crm\mapper\CrmCustomerMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值