MyBatis报错:The content of elements must consist of well-formed character data or markup.

本文介绍了一种在MyBatis的XML配置文件中遇到的特殊字符导致的解析错误,并详细说明了解决方案。

错误:

Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.


排除了一会发现跟下面语句的小于号<有关:



改为这样就没事了:



【像小于号这种特殊符号在mabatis的xml中需要转义】:




package com.lenovo.ofp.order.throwengine.dao; import com.lenovo.ofp.order.domain.throwengine.domain.PaymentMessageVo; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import java.util.List; /** * @Author: zengdy1 * @Date: 2025-09-16 17:50 */ public interface PaymentJobMapper { @Select({ "<script>", "SELECT * FROM ordercommon.t_payment_message", "WHERE process_status = 0", "AND message_type IN", "<foreach collection='messageTypes' item='messageType' open='(' separator=',' close=')'>", "#{messageType}", "</foreach>", "AND create_time > (CURRENT_DATE - INTERVAL '${limit} day')", "</script>" }) List<PaymentMessageVo> getPaymentMessageByType(@Param("messageType") List<Integer> messageType, @Param("limit") Integer limit); @Update({ "<script>", "UPDATE ordercommon.t_payment_message", "SET process_status = 1", "WHERE id IN", "<foreach collection='paymentMessageList' item='item' index='index' open='(' separator=',' close=')'>", "#{item.id}", "</foreach>", "</script>" }) void batchUpdateProcessStatus(@Param("paymentMessageList") List<PaymentMessageVo> authNotifyList);//实现这个批量更新sql @Delete({ "<script>", "DELETE FROM ordercommon.t_payment_message where process_status = 1 AND create_time < (CURRENT_DATE - INTERVAL '${limit} day') ", "</script>" }) Integer batchDelete( @Param("limit") Integer limit); List<PaymentMessageVo> getPaymentMessageByType(int limit); } 结合这个类 分析这个错误org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'paymentMessageJob': Unsatisfied dependency expressed through field 'orderPaymentMapper': Error creating bean with name 'throwPaymentJobMapper' defined in URL [jar:file:/app/lib/order-async-throw-1.0.3-SNAPSHOT.jar!/com/lenovo/ofp/order/throwengine/dao/PaymentJobMapper.class]: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 95; The content of elements must consist of well-formed character data or markup. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredA
最新发布
09-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值