The built-in resource handlers for spring-webmvc and spring-webflux, and functional endpoint equivalents have some duplicate checks and logic that should be shared to avoid getting out of sync. We did such an alignment recently in #33434 across branches, but can also make a further improvement to simplify future changes.