-
Notifications
You must be signed in to change notification settings - Fork 616
Errors when working with graalvm native compilation #2798
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
We are working on this, 1. will be addressed soon. |
This is an oversight / bug in the Spring Boot autoconfiguration for SDN. I'll PR a fix with the team over there. import java.util.Set;
import org.springframework.boot.autoconfigure.domain.EntityScanner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.aot.Neo4jManagedTypes;
import org.springframework.data.neo4j.core.convert.Neo4jConversions;
import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.RelationshipProperties;
@Configuration(proxyBeanMethods = false)
public class F {
@Bean
Neo4jManagedTypes neo4jManagedTypes(ApplicationContext applicationContext) throws ClassNotFoundException {
Set<Class<?>> initialEntityClasses = new EntityScanner(applicationContext).scan(Node.class,
RelationshipProperties.class);
return Neo4jManagedTypes.fromIterable(initialEntityClasses);
}
@Bean
public Neo4jMappingContext neo4jMappingContext(Neo4jManagedTypes managedTypes,
Neo4jConversions neo4jConversions) {
Neo4jMappingContext context = new Neo4jMappingContext(neo4jConversions);
context.setManagedTypes(managedTypes);
return context;
}
} Please let me know if this works for you. |
I have tested it in my project and it's working like a charm. Thanks for the amazing support and the quick solution to the problem! |
Thank you for using and reporting it :) The improvement on Spring Boot side of things is great. |
Hi @michael-simons, |
Oh excellent, thank you so much for your feedback! |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I have a Spring Boot Webflux application and want to create a native image. There I came across two different issues.
1. Saving nodes:
I'm getting an error when saving an node with a reactive repository. I was able to identify the problem. It seems that (at least) the runtime hint for the
ReactiveBeforeBindCallback
is missing. When adding the class to my projects runtime hints the saving of a node works as expected.For the non-reactive class the hint is present (Neo4jRuntimeHints.java#L51) and saving works as expected.
2. Repository with abstract base class:
I have a class hierarchy setup where I have an abstract parent node class and several child classes (see below).
According to the section A note on class hierarchies this use case is supported.
Saving a
ChildNodeA
works as expected resulting in a node with both labelsParentLabel
andChildALabel
.But when calling the
findByName
query an exception is thrown where it seems that it's tried to create an instance ofParentNode
instead ofChildNodeA
. Here I didn't found a solution myself.This behavior is the same for both the reactive repository and the non-reactive repository. If not using graalvm the child class is correctly resolved and instanciated.
Below the exception from the reactive case:
The text was updated successfully, but these errors were encountered: