这是我的代码 希望您花几分钟不到的时间帮我看一下 我搞了1天了 楞是不明白一运行就报 public User IsQueryOne(String id) throws Exception {try{User user = (User) this.getJdbcTemplate().queryForObject("select * from test where id="+id,User.class); return user; }catch(Exception e){ public Object mapRow(ResultSet rs, int value) throws SQLException { User user = new User(); user.setId(new Integer(rs.getInt("id"))); user.setUsername(rs.getString("username")); user.setAge(rs.getString("age")); return user;}}然后在我的方法里直接返回 public User IsQueryOne(String id) throws RuntimeException { String sql="select * from test where id="+id; //现在你看到了我们写的UserRowMapper这个类是多么的方便 return (User) this.getJdbcTemplate().queryForObject(sql,new UserRowMapper());}刚玩这个 下来搞搞AOP了。。。不然acegi搞起来有难度....哎~~无聊呃。。。。