Yesterday I tried to test a bit Spring Native with GrallVM and JPA, after half a day of trying I had to give up, but it’s not the end of the story. I started with JHipster MVC + JPA build and using: https://github.com/jhipster/generator-jhipster/issues/13733 I was able to get it up and running until I started adding JWT. Here I’ve another help from: https://github.com/jwtk/jjwt/issues/637 so I managed to understand and fix JWT issues but also understood that JPA and Hibernate might be harder to bypass so another article with enhance plugin: https://spring.io/blog/2020/06/16/spring-tips-spring-and-graalvm-pt-2 – and this was the last thing I tried, because I got the same errors and it was too hard for me spend more time on this.
Today I started with a new project – because I have no limits what data store to use, I decided to gave up JPA and give Webflux a chance, which I already knew that it would work from the first link, and MongoDB, which I thought could work without problems JPA gave me. I created my own JHipster project, and added the same things I had for JPA. The native image was build without errors in: 04:29 min, then I ran it … Started SampleApp in 1.421 seconds (JVM running for 1.456), but the real test was authentication – my JPA application started too, problems increased later when Hibernate tried dynamically load classes that were not statically linked by AOT (can’t say it’s impossible, just can’t do it properly, probably more experienced GrallVM devs can fix it). The real test was to run authenticate endpoint /api/authenticate
and with MongoDB it worked like charm. The next steps should be to create real model, and move native image to Docker.