我试图用谷歌搜索这个问题,但找不到:IsthererecommendedmethodinSpringjdbcTemplatewhichshouldbeusedwhenweexpect0or1rowstobereturned.当没有行返回时,queryForObject()将抛出异常。queryForList()将需要遍历列表,但这不是问题。但是很好奇是否有返回0或1行的首选/推荐方法。谢谢! 最佳答案 有DataAccessUtils.singleResult(jdbcTemplate.queryForList(...));我相信它