-
Notifications
You must be signed in to change notification settings - Fork 1.1k
java.lang.InstantiationError after upgrading to Spring Boot 2.4.4 (spring data commons 2.4.6) #3608
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
Comments
This looks actually as if the subclass isn't registered with MappingContext. To properly resolve the target class using TypeAlias, it must be already present in the context. Can you isolate the issue and provide a minimal reproducer? |
Hi @mp911de, I've uploaded a sample project where you can reproduce the issue: https://github.com/codependent/mongo-sample2 The instructions are in the readme file. |
|
@mp911de thanks for the suggestion, it solved the problem. What's funny is that with Spring Boot <=2.4.3 it was working without the annotations. Maybe it would be worth mentioning it in the docs. |
That's interesting. I'm not sure why this is. Since Spring Boot does the entity scan, it's worth raising an issue there. |
The Spring Boot 2.4.4-based sample works fine if I downgrade Spring Data to 2020.0.5 (the version used in Spring Boot 2.4.3). If I change the sample to be Spring Boot 2.4.3-based but with Spring Data upgraded to 2020.0.6 then the sample no longer works. As far as I can tell, it's something in Spring Data 2020.0.6 that's causing the problem. |
Let me have another look why this is. |
I entirely missed the fact of the custom Mongo configuration I moved the ticket into Spring Data MongoDB. The difference comes from #3592 where we removed
|
In a Spring Boot application we use Spring Data Mongo to map some documents. Some of them have embedded documents with a hierarchy, e.g.:
Up to Spring Boot 2.4.3 when retrieving a Project instance the corresponding ProjectBudget subclass what built correctly. However after the upgrade to Boot 2.4.4 we get this exception:
There seems to be a regression when instantiating subclasses.
The text was updated successfully, but these errors were encountered: