say I like the syntax of ``` val user = userReposi...
# spring
h
say I like the syntax of
Copy code
val user = userRepository.findByIdOrNull(userId)!!
user.password = "blah"
user.save()
how could I write the
User
class to have access to the
UserRepository
bean? perhaps in an ideal world, the repository could be/inside an object of the user class:
Copy code
class User(...) {
    object Repository : UserRepository
}
or something like that however, objects of kotlin classes cannot have the
@Component
decorator, so cannot be instantiated with beans, afaik I think the appropriate way to go about this is to make
User
a component with a prototype scope