Closed zhaobo-98 closed 1 year ago
https://github.com/mybatis/parent/blob/mybatis-parent-37/pom.xml
mybatis-parent#37 has already set compile-args with -parameters
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin}</version>
<configuration>
<parameters>true</parameters>
<!-- Slightly faster builds, see https://issues.apache.org/jira/browse/MCOMPILER-209 -->
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
u could declare mybatis#3.5.13 both with the latest mybatis-plus
version.
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.13</version>
</dependency>
这个报错可以参考这个链接解决https://github.com/mybatis/spring-boot-starter/wiki/Quick-Start-for-building-native-image,
但是只要一引入mybatis-plus还是会报错,只能先不用Mybatis-plus了
关注后续
报这个错可以参考这个链接解决https://github.com/mybatis/spring-boot-starter/wiki/Quick-Start-for-building-native-image,
但是只要一引入mybatis-plus还是会报错,只能先不用Mybatis-plus了
我尝试后,通过mybatis提供的这个方案,在使用mybatis-spring-boot-starter时可以实现使用native image的编译和运行。 替换为mybatis-plus-boot-starter后可以编译,运行报错。感觉跟使用了反射有关。运行查询方法错误部分内容如下:
之后使用跟踪代理收集元数据。其中提供的说明和代码示例。生成元数据之后再通过mvnw -Pnative native:compile编译为native image,可以正常运行。我只实现了一个查询方法,没有进行更多测试。 元数据中的文件reflect-config.json中应该是以下内容起到了作用:
这个是我目前找到的可以在使用mybatis-plus时实现native image的方法。希望有帮助。
报这个错可以参考这个链接解决https://github.com/mybatis/spring-boot-starter/wiki/Quick-Start-for-building-native-image, 但是只要一引入mybatis-plus还是会报错,只能先不用Mybatis-plus了
我尝试后,通过mybatis提供的这个方案,在使用mybatis-spring-boot-starter时可以实现使用native image的编译和运行。 替换为mybatis-plus-boot-starter后可以编译,运行报错。感觉跟使用了反射有关。运行查询方法错误部分内容如下:
之后使用跟踪代理收集元数据。其中提供的说明和代码示例。生成元数据之后再通过mvnw -Pnative native:compile编译为native image,可以正常运行。我只实现了一个查询方法,没有进行更多测试。 元数据中的文件reflect-config.json中应该是以下内容起到了作用:
这个是我目前找到的可以在使用mybatis-plus时实现native image的方法。希望有帮助。
好的好的, 万分感谢, 我抽空试一下
升级mybatis-plus-boot-starter
中mybatis
相关的版本,项目中引入MyBatisNativeConfiguration
,至此就能顺利编译项目。
如需使用BaseMapper
或者IService
提供的CRUD
方法,还需要手动配置一下mybatis plus
中一些接口的jdk
代理与相关类的反射,这些操作用Tracing Agent
暂时不能收集。
参考的pom.xml
:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
@wssy001 请问有哪些接口和类需要配置呢。。谢谢大佬
@wssy001 请问有哪些接口和类需要配置呢。。谢谢大佬
@shihaoH 可以参考这个discussion
当前使用版本(必填,否则不予处理)
3.5.3.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
重现步骤(如果有就写完整)
mvn clean package -Pnative
报错信息