java Spring启动时出现MyBatis@MapperScan错误
我正试着用MyBatis安装Spring Boot。当我尝试启动应用程序时,出现以下错误:
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:611)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at ...
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
at com.mydomain.Server.launch(Server.java:70)
at com.mydomain.Server.main(Server.java:93)
我在我的pom.xml
中使用了以下版本,以便进行设置:
- spring启动依赖项@1.5.9。释放
- spring cloud dependencies@Edgware。SR1
- mybatis@3.4.5
- mybatis spring@1.3.1
我还包括以下内容:
- 迈巴蒂斯弹簧靴起动器
- spring引导配置处理器
- spring云配置客户端
- SpringBootStarterWeb
- 弹簧靴起动器执行器
- 弹簧靴起动器
我不确定是否有冲突或什么,但它不允许我设置映射器。欢迎提出任何建议
# 1 楼答案
我也有同样的问题
我试过mybatis弹簧靴: https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter/1.3.2
我的应用程序运行正常
我希望它能帮助你
# 2 楼答案
好的-所以问题是mybatis@3.4.5和mybatis spring@1.3.1之间的冲突
当我放下mybatis@3.4.5时,一切都很顺利
# 3 楼答案
您需要添加此maven依赖项: