当前使用版本(必填,否则不予处理)
3.3.0
该问题是如何引起的?(确定最新版也有问题再提!!!)
字段自动填充功能,实现MetaObjectHandler接口,
使用strictInsertFill(MetaObject metaObject, String fieldName, Class
重现步骤(如果有就写完整)
MetaObjectHandler{
default
报错信息
type mismatch
Comment From: miemieYaho
你怎么用的?
Comment From: miemieYaho
用最新版
Comment From: JbfGod
最新版3.3.2的一样的问题
------------------ 原始邮件 ------------------ 发件人: "miemieYaho"<notifications@github.com>; 发送时间: 2020年6月11日(星期四) 中午12:01 收件人: "baomidou/mybatis-plus"<mybatis-plus@noreply.github.com>; 抄送: "。"<976951401@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [baomidou/mybatis-plus] 字段自动填充使用strictInsertFill函数抛出type mismatch的问题 (#2595)
用最新版
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Comment From: JbfGod
你可以找到这2个函数 com.baomidou.mybatisplus.core.handlers.MetaObjectHandler#strictInsertFill(org.apache.ibatis.reflection.MetaObject, java.lang.String, java.lang.Class<T>, java.lang.Object) com.baomidou.mybatisplus.core.handlers.MetaObjectHandler#strictInsertFill(org.apache.ibatis.reflection.MetaObject, java.lang.String, java.lang.Class<T>, java.util.function.Supplier<T>) 它2都调用了com.baomidou.mybatisplus.core.handlers.StrictFill#of(java.lang.String, java.lang.Class<?>, java.lang.Object)这个方法 而不是com.baomidou.mybatisplus.core.handlers.StrictFill#of(java.lang.String, java.lang.Class<?>, java.util.function.Supplier<java.lang.Object>) 但关键是java.util.function.Supplier<java.lang.Object> !!!<Object>的泛型,就算我是StrictFill.of("name", String.class, ()-> "小明"),但调用的还是StrictFill#of(java.lang.String, java.lang.Class<?>, java.lang.Object)
------------------ 原始邮件 ------------------ 发件人: "miemieYaho"<notifications@github.com>; 发送时间: 2020年6月11日(星期四) 中午12:01 收件人: "baomidou/mybatis-plus"<mybatis-plus@noreply.github.com>; 抄送: "。"<976951401@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [baomidou/mybatis-plus] 字段自动填充使用strictInsertFill函数抛出type mismatch的问题 (#2595)
用最新版
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Comment From: JbfGod
所有com.baomidou.mybatisplus.core.handlers.StrictFill#of(java.lang.String, java.lang.Class<?>, java.util.function.Supplier<java.lang.Object>)应该修改为<T> StrictFill of(String fieldName, Class<?> fieldType, Supplier<T> fieldVal) {才能够被正确调用
------------------ 原始邮件 ------------------ 发件人: "miemieYaho"<notifications@github.com>; 发送时间: 2020年6月11日(星期四) 中午12:01 收件人: "baomidou/mybatis-plus"<mybatis-plus@noreply.github.com>; 抄送: "。"<976951401@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [baomidou/mybatis-plus] 字段自动填充使用strictInsertFill函数抛出type mismatch的问题 (#2595)
用最新版
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Comment From: miemieYaho
那用 3.3.3.3-SNAPSHOT 仓库地址 https://oss.sonatype.org/content/repositories/snapshots/
入参里 Supplier 和 Class 进行了位置互调
Comment From: JbfGod
ok