This issue is related to another one, opened in the Spring Data Commons repo: https://github.com/spring-projects/spring-data-commons/issues/2340

Summing up: after upgrading to Spring Boot 2.4.4 our nested Mongodb documents, which form a hierarchy started failing with Caused by: java.lang.InstantiationError: xxx.ProjectBudget

The full description of the problem and a sample project can be found in the mentioned issue.

Note that, previous Boot versions (<=2.4.3) didn't have that problem and didn't require those nested hierarchies to explicitly use @Document.

Comment From: wilkinsona

Thanks for the sample. Unfortunately, I don't think this is a Spring Boot problem. If I update your sample to downgrade Spring Data to 2020.0.5 then the problem does not occur. Similarly if I update your sample to use Spring Boot 2.4.3 but with Spring Data upgraded to 2020.0.6 then the problem does occur. As far as I can tell, it's Spring Data 2020.0.6 that's the cause of the problem. I'll comment to this effect on spring-projects/spring-data-commons#2340 and hopefully @mp911de can take another look.