springboot整合mybatis错误记录(2)

springboot中无法加载dao同级目录下.xml文件

(1)在pom.xml文件下添加如下配置

                      <resource>
				<directory>${basedir}/src/main/java</directory>
				<includes>
					<include>**/**</include>
				</includes>
			</resource>

 (2)在.yml或者.properties文件下添加类似如下配置

mybatis.mapper-locations=com/example/demomybatis/dao/mapping/*.xml
mybatis.type-aliases-package=com.example.demomybatis.entity

 (3)在springboot启动类下添加如下注解

@MapperScan("com.example.demomybatis.dao")

  

猜你喜欢

转载自www.cnblogs.com/ludengxiadeyingzi/p/10558986.html