mybatis plus報Invalid bound statement(not found):解決
Mybatis-Plus mybatis plus報Invalid bound statement(not found):解決 mapperスキャン が配置されていません. 1、mapeprインターフェースにスキャンしないで、mapperスキャン注釈 を配置します.、mapper.xmlファイルをコンパイルしていません. 、mapper.xmlファイルのnamespace属性が正しく設定されていません. 、appration.ymlファイル構成スキャンmapper.xmlパスエラー mybatis plus報Invalid bound statement(not found):解決
こんにちはこれは初めてMarkdownエディタで展示された歓迎ページです.Markdownエディタの使い方を学びたいなら、この文章をよく読んで、Markdownの基本的な文法知識を知ることができます.
mapperスキャンが設定されていません.
1、mapeprインターフェースにスキャンしないで、mapperスキャンの注釈を配置する.
pom.xmlの設定
こんにちはこれは初めてMarkdownエディタで展示された歓迎ページです.Markdownエディタの使い方を学びたいなら、この文章をよく読んで、Markdownの基本的な文法知識を知ることができます.
mapperスキャンが設定されていません.
1、mapeprインターフェースにスキャンしないで、mapperスキャンの注釈を配置する.
@MapperScan("com.baomidou.ant.sys.mapper")
2、mapper.xmlファイルをコンパイルしていません.(classフォルダの下にあるか確認してください.)pom.xmlの設定
<build>
<resources>
<resource>
<directory>src/main/javadirectory>
<excludes>
<exclude>**/*.javaexclude>
excludes>
resource>
<resource>
<directory>src/main/resourcesdirectory>
<includes>
<include>**/*.*include>
includes>
resource>
resources>
build>
3、mapper.xmlファイルのnamespace属性は正しく設定されていません.public interface DemoMapper extends BaseMapper<Demo> {
Demo getDemoById(@Param("id")String id);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.baomidou.ant.sys.mapper.DemoMapper">
<select id="getDemoById" parameterType="java.lang.String" resultType="com.baomidou.ant.sys.entity.Demo">
select * from demo
where id = #{id}
</select>
</mapper>
4、appication.ymlファイル構成スキャンmapper.xmlパスエラーmybatis:
mapper-locations:
classpath*:com/jdw/springboot/mapper/sqlxml/*.xml
type-aliases-package: com.jdw.bean
# mybatis
configuration:
map-underscore-to-camel-case: true
# mybatis SQL
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl