-
Notifications
You must be signed in to change notification settings - Fork 97
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
feat: Spring boot native image support #609
Merged
triceo
merged 12 commits into
TimefoldAI:main
from
Christopher-Chianelli:spring-boot-native
Feb 18, 2024
Merged
feat: Spring boot native image support #609
triceo
merged 12 commits into
TimefoldAI:main
from
Christopher-Chianelli:spring-boot-native
Feb 18, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Additionally, this uses reflection; future work would be to integrate GIZMO code. |
9 tasks
Christopher-Chianelli
force-pushed
the
spring-boot-native
branch
from
February 6, 2024 17:07
4eacc7c
to
bb652ea
Compare
triceo
requested changes
Feb 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major comments:
- Serialization must not be our business. If we don't know how to make it happen, we need to ask the Spring guys. I can not accept responsibility for maintaining our own serialization framework.
- Please use Timefold Solver consistently. Where you're speaking of
Timefold
, you probably should have been speaking ofTimefoldSolver
. - Please include a section in our documentation for Spring on how to build a native image. Especially mention all the quirks of our implementation which may not be immediately obvious, such as any requirements to make anything public.
- Please make sure that the Spring quickstart supports native, and that it is tested as part of the standard PR workflow on the Quickstarts repo.
...toconfigure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/util/PojoInliner.java
Outdated
Show resolved
Hide resolved
...gure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/TimefoldAotContribution.java
Outdated
Show resolved
Hide resolved
...onfigure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/TimefoldBeanFactory.java
Outdated
Show resolved
Hide resolved
...toconfigure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/util/PojoInliner.java
Outdated
Show resolved
Hide resolved
...oot-integration-test/src/main/java/ai/timefold/solver/spring/boot/it/TimefoldController.java
Outdated
Show resolved
Hide resolved
Some outstanding things before we can merge:
|
Spring boot does not seem to have a way to record POJOs to use them in generated files. I written a basic one that assumes all fields on POJOs have public setters and can serialize primitives, builtins, and collection types.
This is to allow spring-integration-test to run in native mode, as it requires a local GraalVM native-image installation.
Also changed the UnsupportedConstraintVerifier class from an anonymous class to an inner class.
…ig to generated method in spring Finding out why ObjectMapper wasn't before was trickly. The short of it is that java.lang.Class was registered for reflection, which made GraalVM think its cachedHashCode field was reachable in an initializer, which is not allowed. So we needed to make registerTypeRecursively ignore java.lang.Class and java.lang.ClassLoader. Then ObjectMapper is happy. I would use SolverConfigIO/JAXB, but JAXB accesses itself using reflection, so I would need to register a bunch more (possible unstable) classes for reflections to use it.
The no-args default constructor is not included in "queryAllDeclaredMethods".
Christopher-Chianelli
force-pushed
the
spring-boot-native
branch
from
February 16, 2024 16:27
96f517c
to
86cbe2c
Compare
…lator classes in Spring error message
Quality Gate passedIssues Measures |
triceo
approved these changes
Feb 18, 2024
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Spring boot does not seem to have a way to record POJOs to use them in generated files. I written a basic one that assumes all fields on POJOs have public setters and can serialize primitives, builtins, and collection types.