Skip to content

R2DBC ConnectionFactory bean silently not created when enabling pooling through R2DBC URL and properties #28144

@mp911de

Description

@mp911de

When enabling connection pooling for R2DBC through both, the URL (spring.r2dbc.url=r2dbc:pool:mysql:…) and by setting the corresponding property (spring.r2dbc.pool.enabled=true), then Spring Boot backs off entirely from creating a ConnectionFactory. In further consequence, downstream components such as R2dbcEntityTemplate are not created leading to hard-to-understand errors such as:

Error creating bean with name 'healthCheckRepository' […] nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'r2dbcEntityTemplate' available
//... 
Description:

Parameter 0 of constructor in application.service.HealthCheckService required a bean named 'r2dbcEntityTemplate' that could not be found. 


Action:

Consider defining a bean named 'r2dbcEntityTemplate' in your configuration.

It would be good to improve the response by either failing hard in such a case or by dropping the pooling configuration advice from the property-based configuration.

Original ticket: spring-projects/spring-data-r2dbc#659

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions