What is the correct way to inject an interface ann...
# spring
l
What is the correct way to inject an interface annotated with
@Repository
in a bean defined using the
beans {}
function? For example, the code below throws an
BeanCreationException
because
PersonRepository
is an interface, but if it's a concrete class it works fine.
Copy code
fun beans() = beans {
    bean<PersonRepository>() // throws BeanCreationException
    bean<PersonHandler>()
}
Copy code
@Repository
interface PersonRepository : ReactiveCrudRepository<Person, String>

class PersonHandler(private val repository: PersonRepository)