spring-projects-experimental/spring-fu

provide a way to use pure spring-r2dbc without spring-data-r2dbc dependency

pull-vert opened this issue · 5 comments

Right now this is impossible because the last line of R2dbcDsl requires spring-data-r2dbc dependency or else throws some java.lang.NoClassDefFoundError (for example on org/springframework/data/r2dbc/core/R2dbcEntityTemplate).

override fun initialize(context: GenericApplicationContext) {
    super.initialize(context)
    init()

    val properties = r2dbcProperties()

    R2dbcInitializer(properties, optionsCustomizers, transactional).initialize(context)
    R2dbcDataInitializer().initialize(context)
}

Actually this is a great idea, and may i add that https://github.com/JetBrains/Exposed is going to be getting r2dbc support in near future which means that r2dbc context could be reused depending on library used

@pull-vert spring-r2dbc is very low level and the new spring-data-r2dbc that leverage it pretty lightweight, what is your use case for it?

@gytis-ivaskevicius Initializers are distincts so we should be able to use R2dbcInitializer in a potential Exposed support.

@sdeleuze the use case I have is visible in my spring-r2dbc-sample that is using kofu together with kotysa-spring-r2dbc.

I needed to add spring-data-r2dbc dependency so I can use kofu's r2dbc DSL for the reason I explained, whereas spring-r2dbc should be sufficient for my kotysa-spring-r2dbc use.

This is mostly a consistency issue, because my spring-jdbc-sample that is using kofu together with kotysa-spring-jdbc uses kofu's jdbc DSL with only spring-jdbc dependency, without the need of spring-data-jdbc.

Yeah good point, I guess we should put Spring Data config in a dedicated namespace with data { r2dbc { } } or dataR2dbc { }, same for JDBC.

I drafted created a PR #342 with a design of dsl to separate r2dbc and spring-data r2dbc.
If it's okay for this design I will add Jafu one in the PR to be merged