工程搭建目录:
@Controller
@RequestMapping(value="/api")
public class TokenController
public interface TokenService
@Service
public class TokenServiceImpl implements TokenService
@Repository
public interface TokenMapper
TokenMapper.xml
当启动工程后,请求Controller报错误信息的主要内容如下:
Invalid bound statement (not found): com.tui.cibs.api.services.TokenService.getTokenByAppId]
该错误的意思是,Spring把TokenService当作Mapper接口注入了,正确情况下,应该只应去注入Repository即Mapper所在的目录,正确的修改如下(在SpringBoot主启动类中添加或修改):
@MapperScan(basePackages="com.ltcui.cibs.**.mapper") // 仅扫描*.mapper目录下的