Benjamin Winterberg opened SPR-17280 and commented

It would be really helpful for my current project if BeanWrapper would support resolving Kotlin Extension Properties.

Please see the following example for demonstration purpose:

data class Person(val firstName: String, val lastName: String)

val Person.fullName: String
    get() = "$firstName $lastName"

...

val person = Person("Peter", "Parker")
val beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(subject)
assertEquals("Peter Parker", beanWrapper.getPropertyValue("fullName"))

Extension Properties are a great way to structure large domain models without cluttering classes with usecase specific domain logic. We currently migrate large parts of our Java domain models to Kotlin. Since we use BeanWrapper for a few major features of our application, we currently have to work around Kotlin extension properties by using reflection to access those properties in case beanWrapper.isReadableProperty yields false.

It would be really helpful if BeanWrapper would support this out of the box, e.g. by passing packages including Kotlin extensions as a second optional argument:

val beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(subject, extensionPackages)

No further details from SPR-17280

Comment From: spring-projects-issues

Sébastien Deleuze commented

Any chance you could contribute such feature via a pull request?

Comment From: spring-projects-issues

Sébastien Deleuze commented

I am not sure this feature would be useful for a wide audience, but seeing the implementation would help to evaluate more accurately. Could you please provide the code of your current workaround?

Comment From: sdeleuze

Closing this issue due to the lack of feedback.