spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
759 stars 344 forks source link

Refactor `StringBasedJdbcQuery` to no longer require `BeanFactory` #1872

Closed mp911de closed 2 days ago

mp911de commented 2 weeks ago

We already accept RowMapperFactory in StringBasedJdbcQuery that could serve as abstraction to not require BeanFactory. JdbcQueryLookupStrategy provides a RowMapperFactory implementation so that JdbcQueryLookupStrategy could serve as entry point for a RowMapperFactory implementation using BeanFactory. We can extend RowMapperFactory to resolve bean references and reduce so coupling in StringBasedJdbcQuery.

schauder commented 1 week ago

Not sure I understand how you envision this.

The BeanFactory is also used to obtain a ResultSetExtractor. Would you have the BeanFactory replaced by a ResultSetExtractor?

mp911de commented 1 week ago

We ask BeanFactory to resolve references for ResultSetExtractor and RowMapper. I would like to extend RowMapperFactory to be able to do that so that we move the lookup into an implementation instead of passing BeanFactory around.