DataClassRowMapper
doesn't pass generic field information to internal TypeConverter:
https://github.com/spring-projects/spring-framework/blob/b595dc1dfad9db534ca7b9e8f46bb9926b88ab5a/spring-jdbc/src/main/java/org/springframework/jdbc/core/DataClassRowMapper.java#L94
As a result any field like this List<MyEnumType> values
will be populated with String
values (heap pollution).
This problem can be solved by replacing the code above with something like this:
args[i] = tc.convertIfNecessary(
getColumnValue(rs, rs.findColumn(name), type),
type,
MethodParameter.forParameter(mappedConstructor.getParameters()[0]))
mappedConstructor.getParameters()
should be extracted as a field for performance reason.