Springboot+Mybatis启动时报错java.lang.StringIndexOutOfBoundsException: String index out of range: -31

it2024-10-17  14

具体报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -31

原因: 父工程和子工程中同时存在mybatis的相关依赖包,因为依赖包冲突从而引起这个报错。

3 解决: 将父工程中的mybatis的相关依赖包移除。

最新回复(0)