Native Image is a new way to build Java applications. It depends on a certain set of assumptions and it is these assumptions that in turn lead to the benefits that Native Image brings (fast startup, low memory etc.).
With these assumputions & benefits there do also come some limitations, although it is worth stressing that there are work arounds for many of these limitations.
Let’s take a look at some of these limitations.
--enable-all-security-services
https
You don’t need them in a shared lib, so Native Image gives you the choice
If you are running inside a container environment, you want shutdown hooks to be installed
--install-exit-handlers
All of your apps classes will be inititalised at runtime. Default behaviour
But be aware you have the power to initialise them at build time. More on this later
These are not invoked in a native image
They are deprecated since JDK 9
They are dangerous :)
Fields accessed from sun.misc.Unsafe
If, and only if, they are stored ina static final
field the memory location will be recomputed when the image is generated
If used in other ways, you need to make use of the RecomputeFieldValue
annotation