Description
I hit the problem described in #27971.
Rather than just adding the <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
to my Surefire configuration, I decided to upgrade to Spring-Boot 2.6.4 (from 2.6.3) to take the fix that was described (because Spring-Boot 2.6.4 uses Spring framework version 5.3.16).
However, this led me to a different error, whereby we hit a org.springframework.beans.factory.BeanNotOfRequiredTypeException
for the lambda bean, specifically:
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'defaultMyThing' is expected to be of type 'com.oliverlockwood.MyThing' but was actually of type 'jdk.proxy2.$Proxy142'
At present, my not-so-pleasant options seem to come down to:
- Run under Java 17, using
--add-opens
JVM argument, and get stuck on Spring Boot 2.6.3 (not great) - Run under Java 11 (not great), but be able to upgrade to Spring Boot 2.6.4
- Run under Java 17 and Spring Boot 2.6.4, but change the lambda beans to be explicit (not great).
I couldn't see a ticket representing this issue, and as Spring-Boot 2.6.4's only recently been released it is plausible that I might be the first person to hit this.