1,mybatis的DAO接口和xml文件直接映射
下载 Free Mybatis plugin 组件
2,required a bean of type '' that could not be found.
run的时候产生的报错,很可能是因为启动文件中MapperScan的annotationClass给的注解类型和mapper接口的注解对不上
3,org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
发送请求的时候报错,一种可能是因为配置文件没有写好
#MyBatis 映射文件通配 mybatis.mapper-locations=classpath:mybatis/*.xml #MyBatis 扫描别名包,和注解 @Alias 联用 mybatis.type-aliases-package=com.hansheng.test.pojo #配置 typeHandler 的扫描包 #mybatis.type-handlers-package=com.hansheng.test.typehandler #mybatis.config-location=classpath:mybatis/mybatis-config.xml 一种可能是xml文件放java文件夹下了,pom.xml添加
<build> <resources> <resource> <directory>src/main/java</directory><!--所在的目录--> <includes><!--包括目录下的.properties,.xml文件都会扫描到--> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build>