Super detailed – springboot + mybatisplus can’t find a solution to mapper using XML
org.apache.ibatis.binding.bindingexception: invalid bound statement (not found): com.zyh.springboot.mapper.bowmapper.findlist
1. First, please look at my project directory, and my XML file is placed under mapper/XML
2, Add the following content in application.yml.
in fact, many students added mybatis plus at the beginning of the project, then add
mapper locations: classpath/COM/zyh/springboot/mapper/XML /. XML at the end.
note: there is no link between packages, such as com.zyh.springboot, which is incorrect
you can see that my mapper locations path is my XML path
#print sql code
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
type-aliases-package: com.zyh.springboot.entity
mapper-locations: classpath*:/com/zyh/springboot/mapper/xml/*.xml
3. Add an XML resource to pom.xml. This step is very important. If you don’t add it, you will always report an error.
regardless of the path, you just need to fill in * /. XML
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
4. Save the code, run the environment, and you can find the mapper
Read More:
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.dao.UserDao
- solve org.apache.ibatis . binding.BindingException : invalid bound statement (not found)
- When I first learned mybatis org.apache.ibatis . binding.BindingException report errors
- Invalid bound statement (not found) of custom SQL in mybatisplus
- How to Fix Invalid bound statement (not found) Error
- Spring boot can’t scan XML (invalid bound statement (not found))
- Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibat
- org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘com/hujin
- org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may
- [How to Fix] org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
- org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null
- Does the version of idea2020.1 import mybayis jar package or report an error? Error: (4,28) Java: package org.apache.ibatis.io does not exist
- Remember a mybatis error org.apache.ibatis . session.defaults.DefaultSqlSession
- Error building SqlSession. ### Cause: org.apache.ibatis.builder.BuilderException: Error creating d
- [solved] closingontransa ctionalSqlSessionorg.apache.ibatis . session.defaults.DefaultSqlSession @20] No information after that.
- [Solved] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
- Tomcat9 Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
- dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
- org.apache.spark.SparkException: Task not serializable
- org.apache.jasper . jasperexception: unable to compile class for jsp: error resolution