Skip to content

Add support for native-image #2166

Open
@mhalbritter

Description

@mhalbritter

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.

Metadata

Metadata

Labels

status: blockedAn issue that's blocked on an external project changetheme: aotAn issue related to Ahead-Of-Time processingtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions