0
RowMapper를 구현하는 BusinessRowMapper 클래스는 PostGres JSONB 객체를 Java 객체로 변환한다.RowMapper를 구현하는 클래스에서 Spring 관리 빈 삽입
BusinessRowMapper implements RowMapper<PersonDetails>
는
public class BusinessRowMapper implements RowMapper<PersonDetails> {
private PersonUtility utils;
public BusinessRowMapper(PersonUtility utils) {
super();
this.utils = utils;
}
public PersonDetails mapRow(final ResultSet rs, final int rowNum) throws SQLException {
PersonDetails personDetail = utils.unMarshallAndConvertData(rs
.getString(ConstantsV4.COLUMN_CUST_DTLS_JSON_DOC));
return personDetail;
}
}
인 mapRow
지금 우선, 나는 봄이 BusinessRowMapper 콩에서 PersonUtility 콩의 주입보다는 BusinessRowMapper에 생성자 인수로 유틸리티 빈 전달을 관리 어떻게해야합니까?getNamedParameterJdbcTemplate().query(
ConstantsV4.RETRIEVE_PERSON_DETAIL_QUERY, params,
new BusinessRowMapper(utility));
의 필드를 autowire하기 수 있습니다. 그리고이 Mapper 빈을 에서 호출하는 방법 - getNamedParameterJdbcTemplate(). query ( ConstantsV4.RETRIEVE_PERSON_DETAIL_QUERY, params, new BusinessRowMapper (유틸리티)); – user842122