-
Notifications
You must be signed in to change notification settings - Fork 41.2k
ConfigurationPropertiesBeanDefinitionValidator interferes with EclipseLink load-time weaving #20798
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
@grimsa Are you able to provide a small sample application that reproduces the problem? |
@philwebb Here you go: https://github.com/grimsa/spring-boot-20798-sample |
Thanks for the sample, @grisma, and for your patience while we found some time to investigate. I've managed to reproduce the problem. In a nutshell, it isn't safe for a Flagging for team attention to see if we can come up with a more elegant solution. |
After upgrading Spring Boot from 2.1 to 2.2 our app failed to start.
Previous working configuration:
New failing configuration:
The symptom - error similar to this:
These methods are normally generated during dynamic weaving performed by EclipseLink (JPA implementation).
org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver
is that class that performs this weaving.This
PersistenceWeaver
is registered inorg.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo#addTransformer
during container entity manager factory creation.Comparing the list of classes that got instrumented beween Spring Boot 2.1 and 2.2 revealed that the list was shorter in version 2.2.
The difference was due to the fact that some of the JPA entity classes were already loaded by the classloader, earlier than
PersistenceWeaver
's class transformation was added to the classloader.I tracked down the location where these classes were getting loaded first and the stack trace was like this:
The bean that was getting validated was similar to this:
Workaround
Removing
org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator
made our app start and work as expected. We simply added this to our configuration:Additional info
ConfigurationPropertiesBeanDefinitionValidator
ConfigurationPropertiesBeanDefinitionValidator
was added in Spring Boot 2.2.0.RC1: Wrong semantic for immutable @ConfigurationProperties contributed via @Import #17831The text was updated successfully, but these errors were encountered: