-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Disable XML bean definition loading when spring.xml.ignore is true #22093
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
Conversation
...ng-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
Outdated
Show resolved
Hide resolved
...ng-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
Outdated
Show resolved
Hide resolved
This commit allows to set the XmlBeanDefinitionReader field from BeanDefinitionLoader to null in a way that allows the GraalVM native compiler to remove it from the native image when the spring.xml.ignore flag introduced by spring-projects/spring-framework#25151 is set to true. The purpose of this change is to allow smaller footprint on native images without requiring to use GraalVM native substitutions which are unmaintainable by nature and also to increase the consistency between JVM and native images. In order to effective, this optimization requires BeanDefinitionLoader class to be initialized at build time.
I have updated this PR to focus only on disabling the XML reader as suggested by @wilkinsona. I was initially confused by the fact that |
This commit allows to set the XmlBeanDefinitionReader field from BeanDefinitionLoader to null in a way that allows the GraalVM native compiler to remove it from the native image when the spring.xml.ignore flag introduced by spring-projects/spring-framework#25151 is set to true. The purpose of this change is to allow smaller footprint on native images without requiring to use GraalVM native substitutions which are unmaintainable by nature and also to increase the consistency between JVM and native images. In order to effective, this optimization requires BeanDefinitionLoader class to be initialized at build time. See gh-22093
Thanks to spring-projects/spring-boot#22093 which brings support of spring.xml.ignore flag natively to Spring Boot. See spring-atticgh-138
Thanks to spring-projects/spring-boot#22093 which brings support of spring.xml.ignore flag natively to Spring Boot. See spring-atticgh-138
Thanks to spring-projects/spring-boot#22093 which brings support of spring.xml.ignore flag natively to Spring Boot. See spring-atticgh-138
This commit allows to set the
XmlBeanDefinitionReader
field fromBeanDefinitionLoader
tonull
in a way that allows the GraalVM native compiler to remove it from the native image when thespring.xml.ignore
flag introduced by spring-projects/spring-framework#25151 is set totrue
. The Groovy reader which relies on the XML one is disabled as well when thespring.xml.ignore flag
is set totrue
.The purpose of this change is to allow smaller footprint on native images without requiring to use GraalVM native substitutions which are unmaintainable by nature and also to increase the consistency between JVM and native images.
In order to effective, this optimization requires
BeanDefinitionLoader
class to be initialized at build time.