Closed as not planned
Description
Description
The @EnableR2dbcRepositories
annotation is not detecting and initializing my R2DBC repositories as expected. This is preventing my application from properly interacting with the database using Spring Data R2DBC.
Current Behavior
When starting the application, no beans are created for my repository interfaces. This results in NoSuchBeanDefinitionException
when trying to autowire these repositories.
Expected Behavior
The @EnableR2dbcRepositories
annotation should detect all interfaces extending CoroutineCrudRepository
(or other Spring Data R2DBC repository interfaces) within the specified base packages, and create the necessary beans for these repositories.
Steps to Reproduce
- Annotated main application class or configuration class with
@EnableR2dbcRepositories
. - Created repository interfaces extending
CoroutineCrudRepository
in a submodule. - Attempted to autowire these repositories in service classes.
- Started the application.
Code Snippets
Main Application Class:
@SpringBootApplication(scanBasePackages = ["mr.hawel"])
@EnableR2dbcRepositories(basePackages = ["mr.hawel.user.persistence"])
class MyApplication
fun main(args: Array<String>) {
runApplication<MyApplication>(*args)
}
UserR2dbcRepository Interface:
@Repository
interface UserR2dbcRepository : CoroutineCrudRepository<UserEntity, UUID> {
suspend fun findByPhoneNumber(phoneNumber: String): UserEntity?
}
Versions:
- spring-boot-starter-data-r2dbc : 3.3.2
Metadata
Metadata
Assignees
Labels
No labels