In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to solve the conflict between Mybatis-plus and pagehelper dependency". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to solve the conflict between Mybatis-plus and pagehelper dependency".
Brief introduction
MyBatis-Plus (MP for short) is an enhancement tool of MyBatis, which is only enhanced but not changed on the basis of MyBatis, in order to simplify development and improve efficiency.
Basic CURD will be automatically injected at startup, performance is basically lossless, and direct object-oriented operation
Mybati-plus has its own paging function, but I have always used pagehelper for paging, so I added pagehelper dependencies in pom, but after running the project, I found that the jar package conflicts, how should we resolve it in the face of conflicts? it can be easily solved after reading the following
Let's start with dependence.
Com.baomidou mybatis-plus-boot-starter 3.1.2 com.baomidou mybatis-plus-generator 3.1.2 com.github.pagehelper pagehelper-spring-boot-starter 1.2.5
Run the project
* *
APPLICATION FAILED TO START
* *
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
Com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder.getLanguageDriver (MybatisMapperAnnotationBuilder.java:369)
The following method did not exist:
Com.baomidou.mybatisplus.core.MybatisConfiguration.getLanguageDriver (Ljava/lang/Class;) Lorg/apache/ibatis/scripting/LanguageDriver
The method's class, com.baomidou.mybatisplus.core.MybatisConfiguration, is available from the following locations:
JarVera fileGroupApplicationsUniverse Mr. WangexMavenGetWord repositoryCompCompPlusMaplusCome CoreCome 3.1.2Onmybatisslay plusCompay 3.1.2.jarPlusCompCompOnOnOnDouUniplusCorePlusCorePlusCome
It was loaded from the following location:
File:/Applications/MrWang/Maven/privite_wang_repository/com/baomidou/mybatis-plus-core/3.1.2/mybatis-plus-core-3.1.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.mybatisplus.core.MybatisConfiguration
Disconnected from the target VM, address: '127.0.0.1 transport:' socket'
Process finished with exit code 0
Correct the classpath of the application to include a single compatible version of com.baomidou.mybatisplus.core.MybatisConfiguration
The red part is gray, look at the meaning in the parentheses behind (for conflict), this package is the same as the above package, the top is bright, the bottom is gray, indicating that the system uses the above jar package, resulting in the following jar package prompt conflict, but why not the following, take some time to study privately, of course, our goal is not to resolve this conflict, because this has been detected by the system The system automatically deactivates one, and we need to resolve conflicts that cannot be detected by the system.
After the introduction of MyBatis-Plus, please do not introduce MyBatis and MyBatis-Spring again to avoid problems caused by version differences. (original words on Mybatis-plus 's official website)
As you can see from the figure above, the pagehelper dependency package also contains MyBatis and MyBatis-Spring, while the MyBatis-Spring dependency conflicts, and the system automatically uses the MyBatis-Spring in Mybatis-plus, so we only need to delete the mybatis dependency in pagehelper, as shown below.
Add exclusions dependencies under version (exclude)
Com.github.pagehelper pagehelper-spring-boot-starter 1.2.5 org.mybatis mybatis
Just restart the project and test it.
These are all the contents of the article "how to solve the conflict between Mybatis-plus and pagehelper dependencies". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.