Spring Boot 3.2.0 / GraalVM 21

When running spring boot 3.2.0 with default jpa data access, application is working fine from a jar file as well as with native plattform binary. However, when creating a custom datasource, application fails when running as a native plattform binary with error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'databaseApplication': Unsatisfied dependency expressed through field 'repository': Error creating bean with name 'myDataRepository': Not a managed type: class com.example.database.entity.MyData

I have created a sample repo which contains a simple spring boot app and explains the issue in README.md.

Please have a look at it. Our project requires custom datasource configuration. Thanks!

Comment From: tjuchniewicz

Reopening https://github.com/spring-attic/spring-native/issues/1688

Comment From: wilkinsona

This looks like a configuration problem to me. You have not configured your graalEMF bean to use the graalPMT bean as its PersistenceManagedTypes. In its auto-configuration, Spring Boot does its equivalent of that here on line 135:

https://github.com/spring-projects/spring-boot/blob/6442954205a34d24a6a8b38dc550def8018c6a3e/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java#L127-L140

Comment From: DigitalMediageek

Thanks for pointing that out, Andy! Looks like this detail is not well documented. There are many unanswered posts about the same subject on StackOverflow.

Comment From: wilkinsona

It's documented here. If you have suggestions for how that could be improved, please make them to the Spring Framework team.