Property 'mapperLocations' was not specified.注解解决
时间: 2023-11-19 21:57:10 浏览: 124
MyBatis异常-Property 'configLocation' not specified, using default MyBatis Configuration
5星 · 资源好评率100%
可以使用@MapperS注解来解决Property 'mapperLocations' was specifi的问题。@MapperS注解可以扫描指定包下的所有Mapper接口,并将其注册到Spring容器中。具体实现步骤如下:\n\1.在Spring B启动类上添加@MapperS注解,指定Mapper接口所在的包路径。\n\```jav\@SpringBootApplicati\@MapperS(\m.examp.\")\publi class DemApplicati {\ publi stati voi mai(String[] args) {\ SpringApplicati.ru(DmApplicati.class, args);\ }\}\```\n\2.在Mapper接口上添加@Mapper注解,标识该接口为Mapper接口。\n\```jav\@Mapper\publi interf UserMapper {\ // ...\}\```\n\这样就可以解决Property 'mapperLocations' was specifi的问题了。\n\
阅读全文