While updating org.springframework.boot to 2.5.12, org.springframework.data:spring-data-rest-webmvc is updated to 3.5.10 as transitive dependency. In this version we found the problem. During bean creation we get the following exception: "java.lang.IllegalAccessError: failed to access class org.springframework.data.rest.webmvc.config.DelegatingHandlerMapping...."
Digging into that we found class DelegatingHandlerMapping made package private (public access specifier removed form the class). We are subclassing configuration class RepositoryRestMvcConfiguration (package org.springframework.data.rest.webmvc.config) to customize the configuration. Within that configuration class, one bean method restHandlerMapping() is returning DelegatingHandlerMapping object. When we are subclassing RepositoryRestMvcConfiguration then the bean method restHandlerMapping() becomes part of that subclass. And the package of the subclass is our local package which is different from the package org.springframework.data.rest.webmvc.config. Since DelegatingHandlerMapping is now package private, while creating bean restHandlerMapping() the IllegalAccessError is showing. Despite the class documentation states that "To customize how the exporter works, subclass this and override..." (https://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.html), that is no longer possible after DelegatingHandlerMapping has been made package private in commit d7f36b1 (https://github.com/spring-projects/spring-data-rest/commit/d7f36b118060157e208aa044eb5c1c038b2c1dc2).
Comment From: bclozel
All the code you're pointing at belongs in Spring Data REST, so there is nothing much we can do here in Framework. Could you create this issue against Spring Data REST? Sorry but I can't transfer this issue myself so I will close it as invalid right now. Thanks!