Mapper inject fail in graalvm

51 views
Skip to first unread message

张三

unread,
Oct 18, 2024, 8:54:17 AMOct 18
to mybatis-user

# version
springboot 3.3.3
mybatisPlus 3.5.8
mybatis-spring 3.0.4
mybatis 3.5.16


# error info

1729247031574.png

# How to solve it

1729246559323.png

in spring jvm spring will change classname to Class, and invoke org.mybatis.spring.mapper.MapperFactoryBean#MapperFactoryBean(java.lang.Class<T>)

in graalvm native ,classname  cannot be to Class, so comment on this line of code,
MapperFactoryBean’s no Parameter constructor will be call,and autowire by setter

org.mybatis.spring.mapper.MapperFactoryBean#setMapperInterface


张三

unread,
Oct 18, 2024, 8:54:17 AMOct 18
to mybatis-user
# version
springboot 3.3.3
mybatisPlus 3.5.8
mybatis-spring 3.5.4
mybatis 3.5.16

# error
1729247031574.png


# How to solve it

1729246559323.png

in spring jvm MapperFactoryBean will be call all arg constructor ,
spring change classname to Class Object, but in graalvm this will be fail.
so I annotated this line of code,spring will call no arg constructor ,and inject by setter method

vps...@gmail.com

unread,
Nov 3, 2024, 9:33:32 PMNov 3
to mybatis-user
换JPA吧,jpa支持的好 ,Mybatis你要自己跑代理执行,手动标识出来反射才能用。

Peter Cao

unread,
Nov 4, 2024, 1:15:05 AMNov 4
to mybati...@googlegroups.com

vps...@gmail.com <vps...@gmail.com> 于2024年11月4日周一 10:33写道:
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mybatis-user/1d073179-4758-4d15-88fe-c23d07308755n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages