Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set R2dbcCustomConversions while using @SpringBootApplication? #353

Closed
peterfigure opened this issue Dec 10, 2020 · 1 comment
Closed

Comments

@peterfigure
Copy link

peterfigure commented Dec 10, 2020

when simply declaring a bean of type R2dbcCustomConversions, it fails with:

00:36:33.182 [restartedMain] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.r2dbc.mapping.R2dbcMappingContext': Unexpected exception during bean creation; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.data.r2dbc.convert.R2dbcCustomConversions' available: expected single matching bean but found 2: org.springframework.data.r2dbc.convert.R2dbcCustomConversions#0,org.springframework.data.r2dbc.convert.R2dbcCustomConversions

something like

configuration {
  beans {
    bean<R2dbcCustomConversions> {}
  }
  r2dbc {
  }
}

even though I notice the bean declared in R2dbcDataAutoConfiguration is declared conditionally:

	@Bean
	@ConditionalOnMissingBean
	public R2dbcCustomConversions r2dbcCustomConversions() {

I believe the above bean is created first (by virtue of @SpringBootApplication), this will make it challenging to partly adopt the kofu DSL which seems to be the desire for others also (#335). My only work around for now is to not use the R2DBC DSL and manually create the required beans.

Sample project illustrating the problem: https://github.com/peterfigure/minimal-kofu - In com.peterfigure.config.ApplicationConfigurationDSL please uncomment bean<R2dbcCustomConversions>() to see the issue.

@peterfigure peterfigure changed the title How to set R2dbcCustomConversions? And custom properties? @SpringBootApplication? How to set R2dbcCustomConversions while using @SpringBootApplication? Dec 14, 2020
@sdeleuze sdeleuze added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 8, 2021
@sdeleuze
Copy link
Collaborator

sdeleuze commented Apr 7, 2021

Good question, this will be clarified as part of #359.

@sdeleuze sdeleuze closed this as completed Apr 7, 2021
@sdeleuze sdeleuze removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants