Similar to what has been done for CRaC with #30606, this issue is about introducing a -Dspring.context.exit=onRefresh property in order to allow to automatically exit from the JVM at onRefresh phase. This is useful when building the AppCDS cache (see also #31497 related issue).