After upgrading from spring boot 2.3.8 to 2.4.2 our following test case fails: CopyPropertiesTest

Basically it loads a spring data projection from MongoDB and tries to copy all of its properties with Spring's BeanUtils.copyProperties into another bean. For some reason "collection"-properties are not copied anymore after the upgrade.

Comment From: philwebb

I'm afraid I can't build that application:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.630 s
[INFO] Finished at: 2021-02-08T10:15:22-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project metadatamanagement: Could not resolve dependencies for project eu.dzhw.fdz:metadatamanagement:war:1.0.107-SNAPSHOT: Failed to collect dependencies at pl.allegro.tech:embedded-elasticsearch:jar:2.11.3: Failed to read artifact descriptor for pl.allegro.tech:embedded-elasticsearch:jar:2.11.3: Could not transfer artifact pl.allegro.tech:embedded-elasticsearch:pom:2.11.3 from/to github (https://maven.pkg.github.com/dzhw/embedded-elasticsearch): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Can you isolate the problem into a smaller sample that we can easily run? I can't see any obvious change in BeanUtils.copyProperties so I suspect the problem might be elsewhere.

Comment From: mbhave

BeanUtils is a Spring Framework class so there isn't anything that we can do about this in Spring Boot itself. This could be related to this change but we would need the Spring Framework team to confirm this.

Comment From: rreitmann

I could set up a smaller spring boot project in order to demonstrate this. However, I am afraid I won't be able to do this before friday. Would that be ok for you?

Comment From: philwebb

@rreitmann That would be great, thanks. The waiting-for-feedback bot might start nagging you, but we'll just reset it if that happens.

Comment From: rreitmann

I had some time for this today, so here is the test in a smaller project which fails in 2.4.2 but passes in 2.3.8: CopyPropertiesExampleApplicationTests

Comment From: sbrannen

I have confirmed that this is a regression beginning with Spring Framework 5.3.0 due to #24281 as suggested by @mbhave.

My initial analysis is that the type information is lost when using ResolvableType.forMethodReturnType(...) for the getOrderLineItems() method in the proxy for the OrderProjection (note that Spring Data creates a proxy that implements the OrderProjection interface). Thus, we are effectively now comparing List<?> to List<String>, deciding that is a mismatch, and skipping the orderLineItems property.

Comment From: sbrannen

This has been fixed in master and will be available in the upcoming 5.3.4 snapshot.

Feel free to give it a try and let us know if you run into any issues.

Comment From: rreitmann

Thanks for the quick fix, I will wait until it is part of a spring boot release.