springboot 不加载mybatiesPlus的mapper.xml文件 的解决方法

1:在pom.xml中加入

	<!-- 编译加载配置文件**/*.xml ,如果不加这个默认springboot 只加载java文件,那么mybaties的mapper.xml在项目中就不能生效,还需要在applicaito
	还需要application.properties 文件中配置一下,缺一不可-->
	<build>
		<resources>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/*.xml</include>
				</includes>
				<filtering>false</filtering>
			</resource>
		</resources>
	</build>

2:在application.properties中加入

#配置mapper xml文件的路径,这个配置以后 mybaties的xml文件就能被编译加载,还需要在pom.xml中配置,这个项目是父工程service
# 的pom.xml加的配置,,两个配置缺一不可
mybatis-plus.mapper-locations=classpath:com/qiyun/edusevice/mapper/xml/*.xml

猜你喜欢

转载自blog.csdn.net/qq_39564710/article/details/113578308
今日推荐