mapper掃描不到AnnotationFormatError : org.mybatis.spring.annotation.MapperScan.factoryBean

轉自https://blog.csdn.net/jiang_zf/article/details/80042445

AnnotationFormatError : org.mybatis.spring.annotation.MapperScan.factoryBean

版權聲明:本文爲博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連接和本聲明。
本文連接: https://blog.csdn.net/jiang_zf/article/details/80042445

SpringBoot集成MybatisPlus,啓動的時候老是報以下錯誤:html

java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean()
at java.lang.reflect.Method.getDefaultValue(Method.java:612) ~[na:1.8.0_161]
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:132) ~[na:1.8.0_161]
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85) ~[na:1.8.0_161]
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266) ~[na:1.8.0_161]
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_161]
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_161]
at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_161]
at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_161]java

at java.lang.Class.getAnnotations(Class.java:3446) ~[na:1.8.0_161]spring

從網上查資料一直覺得是本身的MyBatis和SpingBoot的版本不對,後來才發現,原來是須要一個mybatis-spring-boot-starter的包,在pom文件加上以後,完美解決。mybatis

相關文章
相關標籤/搜索