org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.xxx.service.CitytownService.selectCitytown
出现无法加载sevice层的时候,如下图所示

1,处理方法是,先看下注解@MapperScan内的包地址,是不是指定到dao层或mapper层。

2,如果上述正确,那么再看mybatisplus依赖是否导入正确,如图:
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>对应版本号,与你的springboot兼容的版本</version>
</dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-generator</artifactId><version>对应版本号,与你的springboot兼容的版本</version>
</dependency>
3,再看配置mybatis或mybatisplus的配置文件,yml如下:
mybatis-plus:mapper-locations: classpath*:mapper/*.xmltype-aliases-package: com.xxx.xxx.entityglobal-config:db-config:id-type: autoconfiguration:map-underscore-to-camel-case: truelog-impl: org.apache.ibatis.logging.stdout.StdOutImpl//这里是执行过程的log日志打印
application.properties 配置如下
mybatis-plus.mapper-locations=classpath:mapper/*.xml
mybatis-plus.type-aliases-package=com.xxx.xxx.entity//或者是pojo,也就是实体类
4,都没问题了。问题就解决了。测试执行成功
