org.xml.sax.SAXParseException: 元素类型 “select“ 必须后跟属性规范 “>“ 或 “/>

项目场景:

springBoot项目build编译成功,maven依赖都没问题,项目启动run服务的时候报异常:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoUserController': Unsatisfied dependency expressed through field 'demoUserService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoUserServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoUserMapper' defined in file [E:\workspace\financial-attendance\target\classes\com\luntek\financialattendance\mapper\DemoUserMapper.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.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\financial-attendance\target\classes\mapper\StProjectApproveMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 104; columnNumber: 28; 元素类型 "select" 必须后跟属性规范 ">" 或 "/>"。


问题描述和分析

问题已经很清楚了,创建mapper.xml文件实例失败,也指出了是`\mapper\StProjectApproveMapper.xml`这个xml文件的`lineNumber: 104; columnNumber: 28`104行28列有问题


解决方案:

已经定位到写select语句的时候,设置`parameterType`参数类型的时候是少了个空格。补上即可。 

总结:

springBoot项目build编译是不会检查xml的语法,mapper.xml文件是项目运行时java虚拟机根据mybaits创建文件实例的时候检查报错,遇到问题不用慌,错误日志看起来。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

热心码民阿振

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值