mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Property.resolveName() located the get/is accessor prefix with String.indexOf, which matches the prefix anywhere in the method name. A plain accessor whose name embeds such a prefix (for example budget()) had the wrong portion stripped and resolved to an empty or wrong property name, which in turn caused the backing field's annotations to be silently dropped. Match the get/is prefix only at the start of the method name and do not strip it when the method is a plain accessor for a data class, that is, a non-static no-arg method referring to an instance field of the same name. This supports Java records, Kotlin data classes, and custom Java data classes alike, without relying on java.lang.Record. As a consequence, a getter backed by a field of the exact same name (for example isUrgent()) now resolves to the field name. Closes gh-36911 Signed-off-by: junhyeong9812 <pickjog@gmail.com>