yy764321851
white_season
2019-03-17 17:15

springboot 2.0+mybatis 整合 BaseMapper<T> 接口自带方法报未绑定异常

5
  • spring
  • java
  • eclipse

```# 问题:springboot   2.0+mybatis 整合  
BaseMapper<T> 接口自带方法报未绑定异常
queryUserInfoList可以有返回,queryUserInfo报异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yst.springboot.mapper.UserInfoMapper.selectOne。baseMapper自带方法 查询为什么会报这个异常,有没有人可以帮我看下


@Service
public class UserInfoServiceImpl extends ServiceImpl implements IUserInfoService {
@Autowired
private UserInfoMapper userInfoMapper;

@Override
public List<UserInfo> queryUserInfoList() {
    return userInfoMapper.selectUserInfoList();
}

@Override
public UserInfo queryUserInfo() {
    QueryWrapper<UserInfo> queryWrapper=new QueryWrapper<UserInfo>();
    queryWrapper.eq("NAME", "xiaoming");
    return userInfoMapper.selectOne(queryWrapper);
}

}

**queryOne**

[2019-03-17 17:07:55.870d] [http-nio-8088-exec-1] [ERROR] [o.a.c.c.C.[.[.[/test].[dispatcherServlet]] - Servlet.service() for servlet [dispatcherServlet] in context with path [/test] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yst.springboot.mapper.UserInfoMapper.selectOne] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yst.springboot.mapper.UserInfoMapper.selectOne
at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:232)
at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:50)
at org.apache.ibatis.binding.MapperProxy.lambda$cachedMapperMethod$0(MapperProxy.java:62)
at org.apache.ibatis.binding.MapperProxy$$Lambda$438/810893160.apply(Unknown Source)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:62)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:57)
at com.sun.proxy.$Proxy57.selectOne(Unknown Source)
at com.yst.springboot.service.impl.UserInfoServiceImpl.queryUserInfo(UserInfoServiceImpl.java:36)
at com.yst.springboot.service.impl.UserInfoServiceImpl$$FastClassBySpringCGLIB$$bc171195.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
at com.yst.springboot.service.impl.UserInfoServiceImpl$$EnhancerBySpringCGLIB$$3371fd46.queryUserInfo()
at com.yst.springboot.controller.UserInfoController.queryUserInfo(UserInfoController.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)


**queryList**

[2019-03-17 17:12:10.086d] [http-nio-8088-exec-3] [INFO ] [com.yst.springboot.controller.UserInfoController] - 用户信息:[{"age":25,"name":"张三","sn":"1"},{"age":26,"name":"李四","sn":"2"}]

**mapper接口**

public interface UserInfoMapper extends BaseMapper《UserInfo》 {
List《UserInfo》 selectUserInfoList();
}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐

换一换