spring-projects / spring-projects/spring-data-rest
Add support for native-image
Open
@christophstrobl is already working on this.
Since Jul 28, 2022.
status: blocked
theme: aot
type: enhancement
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
I tried using spring-data-rest in a native image. The native image doesn't start, it fails with this exception: https://ge.spring.io/s/a66xyypotax3k/tests/:data-rest-mongodb:nativeAotTest/com.example.data.rest.mongodb.DataRestMongoDbApplicationAotTests/initializationError?top-execution=1
Main cause is:
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface java.util.List, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na]
at com.oracle.svm.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:158) ~[na:na]
at java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:48) ~[data-rest-mongodb:na]
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037) ~[data-rest-mongodb:na]
at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:126) ~[na:na]
at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:118) ~[na:na]
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:97) ~[na:na]
at org.springframework.plugin.core.support.AbstractTypeAwareSupport.getBeans(AbstractTypeAwareSupport.java:94) ~[data-rest-mongodb:3.0.0-M1]
at org.springframework.plugin.core.support.PluginRegistryFactoryBean.getObject(PluginRegistryFactoryBean.java:38) ~[data-rest-mongodb:3.0.0-M1]
at org.springframework.hateoas.config.HateoasConfiguration.relProviderPluginRegistry(HateoasConfiguration.java:118) ~[data-rest-mongodb:2.0.0-SNAPSHOT]
at org.springframework.hateoas.config.HateoasConfiguration__BeanDefinitions.lambda$getRelProviderPluginRegistryInstanceSupplier$5(HateoasConfiguration__BeanDefinitions.java:138) ~[na:na]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[data-rest-mongodb:6.0.0-SNAPSHOT]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[data-rest-mongodb:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:210) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1224) ~[data-rest-mongodb:6.0.0-SNAPSHOT]
... 101 common frames omitted
See this smoke test for more details.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.