Spring Boot Integration tk.mybatis3.4.0 General Mapper, java.lang.ClassCastException, entities cannot be converted to entities __tk.mybatis

Source: Internet
Author: User

The project uses the Spring boot1.5.2 integrated mybatis Generic Mapper plug-in to discover query methods Selectbyprimarykey

can cause an exception--java.lang.classcastexception:com.xxx.xxx.entity cannot be cast to com.xxx.xxx.entity

test: Insert, UPDATE, delete method is no problem, is the query out of the entity on the report of the exception. Later to GitHub see this is a bug in the plugin


The workaround is as follows:

Create a Meta-inf folder under the Spring Boot Project Resources directory, and create a meta-inf directory

Spring-devtools.properties file


The following code can be added to resolve

restart.include.companycommonlibs=tk/mybatis.*

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.