How to only return String objects from JdbcTemplate queryForList?
问题 By default, queryForList() returns each for as a Map<String, Object> . The object can be plain String , java.sql.Timestamp , etc. List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, params); Question: how can I enfore returning any values as String.class ? So I'd be having a Map<String, String> . I tried: jdbcTemplate.queryForList(sql, params, Map<String, String>.class) But that statement seems to be invalid and does not compile. 回答1: Maybe there is a better way, but the