-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot extend MongoRepository due to private properties / methods / classes #4654
Comments
Let's take a step back and discuss what you actually want to achieve. Subclassing |
Hi Mark, Same issue we discussed on the JPA Github issue :). I'm trying to implement custom pagination behavior for Mongo. I'm extending from Similarly to the solution for doing that in the JPA repo impl, I've implemented classes derived from I don't need to call any of the private methods in my repo impl class, but
I basically tried to duplicate that method in my version so I could add my bean in the but the and the For the factory bean class:
all the stuff in the Although looking at that now, I'm wondering why I didn't override |
Ok, I tested with overriding I took another look at |
Oh yeah, also have to use reflection in a |
By subclassing We are not going to open up Let me know whether you require anything else. |
Hi,
We implemented some custom functionality by extending JpaRepository, JpaRepositoryFactory, JpaRepositoryFactoryBean and SimpleJpaRepository. It was pretty straight forward once we figured out how to use those 4 classes.
Now we are looking at doing the same for SimpleMongoRepository. However, some crucial properties, methods and classes are package private making it impossible to extend those 4 Mongo variety classes without the use of reflection.
The core problem is really extending MongoRepositoryFactory. For the most basic functionality, we need access to:
@nullable RepositoryMetadata metadata) -- requires reflection to call
The text was updated successfully, but these errors were encountered: