question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RepositoryRestMvcConfiguration can no longer be subclassed

See original GitHub issue

Despite the class documentation states that “To customize how the exporter works, subclass this and override…”, that that is no longer possible. The restHandlerMapping() method returns a DelegatingHandlerMapping which has been made package private in commit d7f36b118060157e208aa044eb5c1c038b2c1dc2 related to DATAREST-1540. When subclassing RepositoryRestMvcConfiguration for customisation, I now get the following exception:

Caused by: java.lang.IllegalAccessError: failed to access class org.springframework.data.rest.webmvc.config.DelegatingHandlerMapping from class au.com.onyxtech.horus.config.RepositoryRestConfig$ExtendedRepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$186fd9d8 (org.springframework.data.rest.webmvc.config.DelegatingHandlerMapping and au.com.onyxtech.horus.config.RepositoryRestConfig$ExtendedRepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$186fd9d8 are in unnamed module of loader 'app')
	at au.com.onyxtech.horus.config.RepositoryRestConfig$ExtendedRepositoryRestMvcConfiguration$$EnhancerBySpringCGLIB$$186fd9d8.restHandlerMapping(<generated>)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 89 common frames omitted

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tgeenscommented, Jul 8, 2021

I managed to workaround this by using a BeanPostProcessor to replace the beans I wanted to override, instead of subclassing RepositoryRestMvcConfiguration

1reaction
alienistycommented, Jul 15, 2021

3 might just have been solved with this ticket as RIF actually uses Repositories to look up the repository to invoke eventually.

Yes it is. Confirmed using 2021.1.0-SNAPSHOT

Read more comments on GitHub >

github_iconTop Results From Across the Web

RepositoryRestMvcConfiguration (Spring Data REST 4.0.0 API)
Main application configuration for Spring Data REST. To customize how the exporter works, subclass this and override any of the configure* methods.
Read more >
Extending RepositoryRestMvcConfiguration breaks Jackson ...
EDIT: I've solved the problem by annotating my LocalDateTime properties to specify what serialiser and deserialiser to use, but that feels more ......
Read more >
Defining a subclass - IBM
Restriction: You cannot use multiple inheritance in your COBOL programs. Each COBOL class that you define must have exactly one immediate superclass that...
Read more >
Java – @RepositoryRestController custom controller with ... - iTecNote
{RepositoryRestMvcConfiguration.class}; } @Override protected String[] ... Java's static typing system isn't really designed to support this unless the ...
Read more >
Example usage for org.springframework.data.rest.webmvc ...
Introduction. In this page you can find the example usage for org.springframework.data.rest.webmvc.config RepositoryRestMvcConfiguration subclass-usage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found