Originally reported at https://github.com/spring-projects/spring-boot/issues/33351. It looks like Spring Data isn't contributing the necessary reflection hints to allow BeanWrapper.KotlinCopyUtil.setProperty to find and invoke the copy method.

Comment From: christophstrobl

thanks @wilkinsona - we'll take care of it.

Comment From: christophstrobl

Looking at BindingReflectionHintsRegistrar.KotlinDelegate the registerComponentHints method only registers the ones where name equals copy which misses those named copy$default. \ cc @sdeleuze

Comment From: christophstrobl

adding reflection for the copy$default methods solves the issue. Think we should fix this in framework.

hints.reflection().registerType(Book::class.java) {
    it.withMethod(
        "copy\$default",
        listOf(
            TypeReference.of(Book::class.java),
            TypeReference.of(java.lang.Long::class.java),
            TypeReference.of(java.lang.String::class.java),
            TypeReference.of(Int::class.java),
            TypeReference.of(java.lang.Object::class.java)),
        ExecutableMode.INVOKE
    )
}
hints.reflection().registerType(Author::class.java) {
    it.withMethod(
        "copy\$default",
        listOf(
            TypeReference.of(Author::class.java),
            TypeReference.of(java.lang.Long::class.java),
            TypeReference.of(java.lang.String::class.java),
            TypeReference.of(java.util.Set::class.java),
            TypeReference.of(Int::class.java),
            TypeReference.of(java.lang.Object::class.java)),
        ExecutableMode.INVOKE
    )
}

Comment From: wilkinsona

Thanks, @christophstrobl. I agree that a fix for this belongs in Framework.

Comment From: sdeleuze

We should also probably configure queryAllDeclaredMethods on those types, see this comment.