正常使用mybatisplus
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.0.4</version> </dependency>
使用后發現項目中原先對枚舉值的轉換存在異常:
ERROR com.shein.common.handler.SheinExceptionHandler 統一異常處理,接口:..../page,
異常信息:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'apply_type' from result set.
Cause: java.lang.IllegalArgumentException: No enum constant com......enums.ApplyTypeEnum.2
官網給的解釋:
https://github.com/baomidou/mybatis-plus/issues/522
兩種解決方案
1.降級對應的mybatisPlus 版本 由 3.0.4 ->3.0-RC3
2.若項目中使用了 spring-boot-devtools 移除對 spring-boot-devtools 的依賴