mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Reorganize packaging and optimizing documentation
Documentation for native executables, CDS, and checkpoint/restore are now under a common heading in the reference documentation, along with sections on building container images. A few sections containing prescriptive workflows have been moved from reference to how-to guides. This consolidates and improves the consistency of recommendations on how to package and run applications. Closes gh-40977
This commit is contained in:
parent
16302c18b2
commit
2df0c7961a
@ -115,9 +115,9 @@ If your application needs IO capabilities, see one or more of the following sect
|
||||
|
||||
Spring Boot provides first-class support for building efficient container images. You can read more about it here:
|
||||
|
||||
* *Efficient Container Images:* xref:reference:container-images/efficient-images.adoc[Tips to optimize container images such as Docker images]
|
||||
* *Dockerfiles:* xref:reference:container-images/dockerfiles.adoc[Building container images using dockerfiles]
|
||||
* *Cloud Native Buildpacks:* xref:reference:container-images/cloud-native-buildpacks.adoc[Support for Cloud Native Buildpacks with Maven and Gradle]
|
||||
* *Efficient Container Images:* xref:reference:packaging/container-images/efficient-images.adoc[Tips to optimize container images such as Docker images]
|
||||
* *Dockerfiles:* xref:reference:packaging/container-images/dockerfiles.adoc[Building container images using dockerfiles]
|
||||
* *Cloud Native Buildpacks:* xref:reference:packaging/container-images/cloud-native-buildpacks.adoc[Support for Cloud Native Buildpacks with Maven and Gradle]
|
||||
|
||||
|
||||
|
||||
@ -132,17 +132,15 @@ When you are ready to push your Spring Boot application to production, we have x
|
||||
|
||||
|
||||
|
||||
[[documentation.native-images]]
|
||||
== GraalVM Native Images
|
||||
[[documentation.packaging]]
|
||||
== Optimizing for Production
|
||||
|
||||
Spring Boot applications can be converted into native executables using GraalVM.
|
||||
You can read more about our native image support here:
|
||||
|
||||
* *GraalVM Native Images:* xref:reference:native-image/introducing-graalvm-native-images.adoc[Introduction] | xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[Key Differences with the JVM] | xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing[Ahead-of-Time Processing]
|
||||
* *Getting Started:* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks[Buildpacks] | xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools[Native Build Tools]
|
||||
* *Testing:* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-the-jvm[JVM] | xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-native-build-tools[Native Build Tools]
|
||||
* *Advanced Topics:* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.nested-configuration-properties[Nested Configuration Properties] | xref:reference:native-image/advanced-topics.adoc#native-image.advanced.converting-executable-jars[Converting JARs] | xref:reference:native-image/advanced-topics.adoc#native-image.advanced.known-limitations[Known Limitations]
|
||||
Spring Boot applications can be optimized for production using technologies described in these sections:
|
||||
|
||||
* *Efficient Deployments:* xref:reference:packaging/efficient.adoc#packaging.efficient.unpacking[Unpacking the Executable JAR]
|
||||
* *GraalVM Native Images:* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[Introduction] | xref:reference:packaging/native-image/advanced-topics.adoc[Advanced Topics] | xref:how-to:native-image/developing-your-first-application.adoc[Getting Started] | xref:how-to:native-image/testing-native-applications.adoc[Testing]
|
||||
* *Class Data Sharing:* xref:reference:packaging/class-data-sharing.adoc[Overview]
|
||||
* *Checkpoint and Restore* xref:reference:packaging/checkpoint-restore.adoc[Overview]
|
||||
|
||||
|
||||
[[documentation.advanced]]
|
||||
@ -150,6 +148,6 @@ You can read more about our native image support here:
|
||||
|
||||
Finally, we have a few topics for more advanced users:
|
||||
|
||||
* *Spring Boot Applications Deployment:* xref:reference:deployment/cloud.adoc[Cloud Deployment] | xref:reference:deployment/installing.adoc[OS Service]
|
||||
* *Spring Boot Applications Deployment:* xref:how-to:deployment/cloud.adoc[Cloud Deployment] | xref:how-to:deployment/installing.adoc[OS Service]
|
||||
* *Build tool plugins:* xref:maven-plugin:index.adoc[Maven] | xref:gradle-plugin:index.adoc[Gradle]
|
||||
* *Appendix:* xref:appendix:application-properties/index.adoc[Application Properties] | xref:specification:configuration-metadata/index.adoc[Configuration Metadata] | xref:appendix:auto-configuration-classes/index.adoc[Auto-configuration Classes] | xref:appendix:test-auto-configuration/index.adoc[Test Auto-configuration Annotations] | xref:specification:executable-jar/index.adoc[Executable Jars] | xref:appendix:dependency-versions/index.adoc[Dependency Versions]
|
||||
|
@ -10,10 +10,10 @@
|
||||
* xref:reference:data/index.adoc[data]
|
||||
* xref:reference:io/index.adoc[io]
|
||||
* xref:reference:messaging/index.adoc[messaging]
|
||||
* xref:reference:container-images/index.adoc[container-images]
|
||||
* xref:reference:packaging/container-images/index.adoc[container-images]
|
||||
* xref:reference:actuator/index.adoc[actuator]
|
||||
* xref:reference:deployment/index.adoc[deployment]
|
||||
* xref:reference:native-image/index.adoc[native-image]
|
||||
* xref:how-to:deployment/index.adoc[deployment]
|
||||
* xref:reference:packaging/native-image/index.adoc[native-image]
|
||||
* xref:cli:index.adoc[cli]
|
||||
* xref:build-tool-plugin:index.adoc[build-tool-plugins]
|
||||
* xref:how-to:index.adoc[howto]
|
||||
@ -33,10 +33,10 @@
|
||||
* xref:reference:data/index.adoc[#data]
|
||||
* xref:reference:io/index.adoc[#io]
|
||||
* xref:reference:messaging/index.adoc[#messaging]
|
||||
* xref:reference:container-images/index.adoc[#container-images]
|
||||
* xref:reference:packaging/container-images/index.adoc[#container-images]
|
||||
* xref:reference:actuator/index.adoc[#actuator]
|
||||
* xref:reference:deployment/index.adoc[#deployment]
|
||||
* xref:reference:native-image/index.adoc[#native-image]
|
||||
* xref:how-to:deployment/index.adoc[#deployment]
|
||||
* xref:reference:packaging/native-image/index.adoc[#native-image]
|
||||
* xref:cli:index.adoc[#cli]
|
||||
* xref:build-tool-plugin:index.adoc[#build-tool-plugins]
|
||||
* xref:how-to:index.adoc[#howto]
|
||||
@ -57,7 +57,7 @@
|
||||
* xref:ROOT:documentation.adoc#documentation.first-steps[#documentation.first-steps]
|
||||
* xref:ROOT:documentation.adoc#documentation.io[#documentation.io]
|
||||
* xref:ROOT:documentation.adoc#documentation.messaging[#documentation.messaging]
|
||||
* xref:ROOT:documentation.adoc#documentation.native-images[#documentation.native-images]
|
||||
* xref:ROOT:documentation.adoc#documentation.packaging[#documentation.packaging]
|
||||
* xref:ROOT:documentation.adoc#documentation.upgrading[#documentation.upgrading]
|
||||
* xref:ROOT:documentation.adoc#documentation.using[#documentation.using]
|
||||
* xref:ROOT:documentation.adoc#documentation.web[#documentation.web]
|
||||
@ -444,10 +444,10 @@
|
||||
* xref:how-to:testing.adoc#howto.testing.slice-tests[#howto.testing.slice-tests]
|
||||
* xref:how-to:testing.adoc#howto.testing.with-spring-security[#howto.testing.with-spring-security]
|
||||
* xref:how-to:testing.adoc#howto.testing.with-spring-security[#howto-use-test-with-spring-security]
|
||||
* xref:how-to:traditional-deployment.adoc#howto.traditional-deployment[#howto.traditional-deployment]
|
||||
* xref:how-to:traditional-deployment.adoc#howto.traditional-deployment.convert-existing-application[#howto.traditional-deployment.convert-existing-application]
|
||||
* xref:how-to:traditional-deployment.adoc#howto.traditional-deployment.war[#howto.traditional-deployment.war]
|
||||
* xref:how-to:traditional-deployment.adoc#howto.traditional-deployment.weblogic[#howto.traditional-deployment.weblogic]
|
||||
* xref:how-to:deployment/traditional-deployment.adoc#howto.traditional-deployment[#howto.traditional-deployment]
|
||||
* xref:how-to:deployment/traditional-deployment.adoc#howto.traditional-deployment.convert-existing-application[#howto.traditional-deployment.convert-existing-application]
|
||||
* xref:how-to:deployment/traditional-deployment.adoc#howto.traditional-deployment.war[#howto.traditional-deployment.war]
|
||||
* xref:how-to:deployment/traditional-deployment.adoc#howto.traditional-deployment.weblogic[#howto.traditional-deployment.weblogic]
|
||||
* xref:how-to:webserver.adoc#howto-configure-webserver-customizers[#howto-configure-webserver-customizers]
|
||||
* xref:how-to:webserver.adoc#howto.webserver[#howto.webserver]
|
||||
* xref:how-to:webserver.adoc#howto.webserver.add-servlet-filter-listener[#howto.webserver.add-servlet-filter-listener]
|
||||
@ -882,16 +882,16 @@
|
||||
* xref:reference:actuator/tracing.adoc#actuator.micrometer-tracing.tracer-implementations.otel-wavefront[#actuator.micrometer-tracing.tracer-implementations.otel-wavefront]
|
||||
* xref:reference:actuator/tracing.adoc#actuator.micrometer-tracing.tracer-implementations.otel-zipkin[#actuator.micrometer-tracing.tracer-implementations.otel-zipkin]
|
||||
* xref:reference:actuator/tracing.adoc#actuator.micrometer-tracing.tracers[#actuator.micrometer-tracing.tracers]
|
||||
* xref:reference:container-images/cloud-native-buildpacks.adoc#container-images.buildpacks[#boot-features-container-images-buildpacks]
|
||||
* xref:reference:container-images/cloud-native-buildpacks.adoc#container-images.buildpacks[#container-images.buildpacks]
|
||||
* xref:reference:container-images/dockerfiles.adoc#container-images.dockerfiles[#container-images.dockerfiles]
|
||||
* xref:reference:container-images/dockerfiles.adoc#container-images.dockerfiles[#boot-features-container-images-docker]
|
||||
* xref:reference:container-images/efficient-images.adoc#container-images.efficient-images[#container-images.efficient-images]
|
||||
* xref:reference:container-images/efficient-images.adoc#container-images.efficient-images[#boot-features-container-images]
|
||||
* xref:reference:container-images/efficient-images.adoc#container-images.efficient-images[#boot-features-container-images-building]
|
||||
* xref:reference:container-images/efficient-images.adoc#container-images.efficient-images.layering[#container-images.efficient-images.layering]
|
||||
* xref:reference:container-images/efficient-images.adoc#container-images.efficient-images.layering[#boot-layering-docker-images]
|
||||
* xref:reference:container-images/index.adoc#container-images[#container-images]
|
||||
* xref:reference:packaging/container-images/cloud-native-buildpacks.adoc#packaging.container-images.buildpacks[#boot-features-container-images-buildpacks]
|
||||
* xref:reference:packaging/container-images/cloud-native-buildpacks.adoc#packaging.container-images.buildpacks[#container-images.buildpacks]
|
||||
* xref:reference:packaging/container-images/dockerfiles.adoc#packaging.container-images.dockerfiles[#container-images.dockerfiles]
|
||||
* xref:reference:packaging/container-images/dockerfiles.adoc#packaging.container-images.dockerfiles[#boot-features-container-images-docker]
|
||||
* xref:reference:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images[#container-images.efficient-images]
|
||||
* xref:reference:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images[#boot-features-container-images]
|
||||
* xref:reference:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images[#boot-features-container-images-building]
|
||||
* xref:reference:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images.layering[#container-images.efficient-images.layering]
|
||||
* xref:reference:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images.layering[#boot-layering-docker-images]
|
||||
* xref:reference:packaging/container-images/index.adoc#packaging.container-images[#container-images]
|
||||
* xref:reference:data/index.adoc#data[#data]
|
||||
* xref:reference:data/nosql.adoc#data.nosql[#boot-features-nosql]
|
||||
* xref:reference:data/nosql.adoc#data.nosql[#data.nosql]
|
||||
@ -1003,45 +1003,45 @@
|
||||
* xref:reference:data/sql.adoc#data.sql.r2dbc.repositories[#boot-features-spring-data-r2dbc-repositories]
|
||||
* xref:reference:data/sql.adoc#data.sql.r2dbc.using-database-client[#data.sql.r2dbc.using-database-client]
|
||||
* xref:reference:data/sql.adoc#data.sql.r2dbc.using-database-client[#boot-features-r2dbc-using-database-client]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud[#deployment.cloud]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.aws[#deployment.cloud.aws]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.aws.beanstalk[#deployment.cloud.aws.beanstalk]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.aws.beanstalk.java-se-platform[#deployment.cloud.aws.beanstalk.java-se-platform]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.aws.beanstalk.tomcat-platform[#deployment.cloud.aws.beanstalk.tomcat-platform]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.aws.summary[#deployment.cloud.aws.summary]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.azure[#deployment.cloud.azure]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.boxfuse[#deployment.cloud.boxfuse]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.cloud-foundry[#deployment.cloud.cloud-foundry]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.cloud-foundry.binding-to-services[#deployment.cloud.cloud-foundry.binding-to-services]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.google[#deployment.cloud.google]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.heroku[#deployment.cloud.heroku]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.kubernetes[#deployment.cloud.kubernetes]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.kubernetes.container-lifecycle[#deployment.cloud.kubernetes.container-lifecycle]
|
||||
* xref:reference:deployment/cloud.adoc#deployment.cloud.openshift[#deployment.cloud.openshift]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient[#deployment.efficient]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient.aot[#deployment.efficient.aot]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient.checkpoint-restore[#deployment.efficient.checkpoint-restore]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient.unpacking[#containers-deployment]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient.unpacking[#deployment.containers]
|
||||
* xref:reference:deployment/efficient.adoc#deployment.efficient.unpacking[#deployment.efficient.unpacking]
|
||||
* xref:reference:deployment/index.adoc#deployment[#deployment]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing[#deployment-install-supported-operating-systems]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing[#deployment.installing]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing[#deployment-service]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d[#deployment.installing.init-d]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d[#deployment-initd-service]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization[#deployment-script-customization]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization[#deployment.installing.init-d.script-customization]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-running[#deployment-script-customization-when-it-runs]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-running[#deployment.installing.init-d.script-customization.when-running]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-running.conf-file[#deployment.installing.init-d.script-customization.when-running.conf-file]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-written[#deployment-script-customization-when-it-written]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-written[#deployment.installing.init-d.script-customization.when-written]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.securing[#deployment.installing.init-d.securing]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.init-d.securing[#deployment-initd-service-securing]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.system-d[#deployment-systemd-service]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.system-d[#deployment.installing.system-d]
|
||||
* xref:reference:deployment/installing.adoc#deployment.installing.windows-services[#deployment.installing.windows-services]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud[#deployment.cloud]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.aws[#deployment.cloud.aws]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.aws.beanstalk[#deployment.cloud.aws.beanstalk]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.aws.beanstalk.java-se-platform[#deployment.cloud.aws.beanstalk.java-se-platform]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.aws.beanstalk.tomcat-platform[#deployment.cloud.aws.beanstalk.tomcat-platform]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.aws.summary[#deployment.cloud.aws.summary]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.azure[#deployment.cloud.azure]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.boxfuse[#deployment.cloud.boxfuse]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.cloud-foundry[#deployment.cloud.cloud-foundry]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.cloud-foundry.binding-to-services[#deployment.cloud.cloud-foundry.binding-to-services]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.google[#deployment.cloud.google]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.heroku[#deployment.cloud.heroku]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes[#deployment.cloud.kubernetes]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes.container-lifecycle[#deployment.cloud.kubernetes.container-lifecycle]
|
||||
* xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.openshift[#deployment.cloud.openshift]
|
||||
* xref:reference:packaging/efficient.adoc#packaging.efficient[#deployment.efficient]
|
||||
* xref:reference:packaging/aot.adoc#packaging.aot[#deployment.efficient.aot]
|
||||
* xref:reference:packaging/checkpoint-restore.adoc#packaging.checkpoint-restore[#deployment.efficient.checkpoint-restore]
|
||||
* xref:reference:packaging/efficient.adoc#packaging.efficient.unpacking[#containers-deployment]
|
||||
* xref:reference:packaging/efficient.adoc#packaging.efficient.unpacking[#deployment.containers]
|
||||
* xref:reference:packaging/efficient.adoc#packaging.efficient.unpacking[#deployment.efficient.unpacking]
|
||||
* xref:how-to:deployment/index.adoc#howto.deployment[#deployment]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing[#deployment-install-supported-operating-systems]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing[#deployment.installing]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing[#deployment-service]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d[#deployment.installing.init-d]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d[#deployment-initd-service]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization[#deployment-script-customization]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization[#deployment.installing.init-d.script-customization]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-running[#deployment-script-customization-when-it-runs]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-running[#deployment.installing.init-d.script-customization.when-running]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-running.conf-file[#deployment.installing.init-d.script-customization.when-running.conf-file]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-written[#deployment-script-customization-when-it-written]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-written[#deployment.installing.init-d.script-customization.when-written]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.securing[#deployment.installing.init-d.securing]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.init-d.securing[#deployment-initd-service-securing]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.system-d[#deployment-systemd-service]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.system-d[#deployment.installing.system-d]
|
||||
* xref:how-to:deployment/installing.adoc#howto.deployment.installing.windows-services[#deployment.installing.windows-services]
|
||||
* xref:reference:features/aop.adoc#features.aop[#features.aop]
|
||||
* xref:reference:features/developing-auto-configuration.adoc#features.developing-auto-configuration[#features.developing-auto-configuration]
|
||||
* xref:reference:features/developing-auto-configuration.adoc#features.developing-auto-configuration.condition-annotations[#features.developing-auto-configuration.condition-annotations]
|
||||
@ -1360,42 +1360,42 @@
|
||||
* xref:reference:messaging/spring-integration.adoc#messaging.spring-integration[#boot-features-integration]
|
||||
* xref:reference:messaging/websockets.adoc#messaging.websockets[#boot-features-websockets]
|
||||
* xref:reference:messaging/websockets.adoc#messaging.websockets[#messaging.websockets]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced[#native-image.advanced]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.converting-executable-jars[#native-image.advanced.converting-executable-jars]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.converting-executable-jars.buildpacks[#native-image.advanced.converting-executable-jars.buildpacks]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.converting-executable-jars.native-image[#native-image.advanced.converting-executable-jars.native-image]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.custom-hints[#native-image.advanced.custom-hints]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.custom-hints.testing[#native-image.advanced.custom-hints.testing]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.known-limitations[#native-image.advanced.known-limitations]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.nested-configuration-properties[#native-image.advanced.nested-configuration-properties]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.using-the-tracing-agent[#native-image.advanced.using-the-tracing-agent]
|
||||
* xref:reference:native-image/advanced-topics.adoc#native-image.advanced.using-the-tracing-agent.launch[#native-image.advanced.using-the-tracing-agent.launch]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application[#native-image.developing-your-first-application]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks[#native-image.developing-your-first-application.buildpacks]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.gradle[#native-image.developing-your-first-application.buildpacks.gradle]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.maven[#native-image.developing-your-first-application.buildpacks.maven]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.running[#native-image.developing-your-first-application.buildpacks.running]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.system-requirements[#native-image.developing-your-first-application.buildpacks.system-requirements]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools[#native-image.developing-your-first-application.native-build-tools]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.gradle[#native-image.developing-your-first-application.native-build-tools.gradle]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.maven[#native-image.developing-your-first-application.native-build-tools.maven]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.prerequisites[#native-image.developing-your-first-application.native-build-tools.prerequisites]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos[#native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.prerequisites.windows[#native-image.developing-your-first-application.native-build-tools.prerequisites.windows]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.running[#native-image.developing-your-first-application.native-build-tools.running]
|
||||
* xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.sample-application[#native-image.developing-your-first-application.sample-application]
|
||||
* xref:reference:native-image/index.adoc#native-image[#native-image]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images[#native-image.introducing-graalvm-native-images]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[#native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing[#native-image.introducing-graalvm-native-images.understanding-aot-processing]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation[#native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation[#native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation]
|
||||
* xref:reference:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation[#native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation]
|
||||
* xref:reference:native-image/testing-native-applications.adoc#native-image.testing[#native-image.testing]
|
||||
* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-native-build-tools[#native-image.testing.with-native-build-tools]
|
||||
* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-native-build-tools.gradle[#native-image.testing.with-native-build-tools.gradle]
|
||||
* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-native-build-tools.maven[#native-image.testing.with-native-build-tools.maven]
|
||||
* xref:reference:native-image/testing-native-applications.adoc#native-image.testing.with-the-jvm[#native-image.testing.with-the-jvm]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced[#native-image.advanced]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.converting-executable-jars[#native-image.advanced.converting-executable-jars]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.converting-executable-jars.buildpacks[#native-image.advanced.converting-executable-jars.buildpacks]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.converting-executable-jars.native-image[#native-image.advanced.converting-executable-jars.native-image]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.custom-hints[#native-image.advanced.custom-hints]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.custom-hints.testing[#native-image.advanced.custom-hints.testing]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.known-limitations[#native-image.advanced.known-limitations]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.nested-configuration-properties[#native-image.advanced.nested-configuration-properties]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.using-the-tracing-agent[#native-image.advanced.using-the-tracing-agent]
|
||||
* xref:reference:packaging/native-image/advanced-topics.adoc#packaging.native-image.advanced.using-the-tracing-agent.launch[#native-image.advanced.using-the-tracing-agent.launch]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application[#native-image.developing-your-first-application]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks[#native-image.developing-your-first-application.buildpacks]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.gradle[#native-image.developing-your-first-application.buildpacks.gradle]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.maven[#native-image.developing-your-first-application.buildpacks.maven]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.running[#native-image.developing-your-first-application.buildpacks.running]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.system-requirements[#native-image.developing-your-first-application.buildpacks.system-requirements]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools[#native-image.developing-your-first-application.native-build-tools]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.gradle[#native-image.developing-your-first-application.native-build-tools.gradle]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.maven[#native-image.developing-your-first-application.native-build-tools.maven]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.prerequisites[#native-image.developing-your-first-application.native-build-tools.prerequisites]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos[#native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.prerequisites.windows[#native-image.developing-your-first-application.native-build-tools.prerequisites.windows]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.running[#native-image.developing-your-first-application.native-build-tools.running]
|
||||
* xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.sample-application[#native-image.developing-your-first-application.sample-application]
|
||||
* xref:reference:packaging/native-image/index.adoc#packaging.native-image[#native-image]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images[#native-image.introducing-graalvm-native-images]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[#packaging.native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing[#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation[#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation[#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation]
|
||||
* xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation[#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation]
|
||||
* xref:how-to:native-image/testing-native-applications.adoc#howto.native-image.testing[#native-image.testing]
|
||||
* xref:how-to:native-image/testing-native-applications.adoc#howto.native-image.testing.with-native-build-tools[#native-image.testing.with-native-build-tools]
|
||||
* xref:how-to:native-image/testing-native-applications.adoc#howto.native-image.testing.with-native-build-tools.gradle[#native-image.testing.with-native-build-tools.gradle]
|
||||
* xref:how-to:native-image/testing-native-applications.adoc#howto.native-image.testing.with-native-build-tools.maven[#native-image.testing.with-native-build-tools.maven]
|
||||
* xref:how-to:native-image/testing-native-applications.adoc#howto.native-image.testing.with-the-jvm[#native-image.testing.with-the-jvm]
|
||||
* xref:reference:using/auto-configuration.adoc#using.auto-configuration[#using.auto-configuration]
|
||||
* xref:reference:using/auto-configuration.adoc#using.auto-configuration.disabling-specific[#using.auto-configuration.disabling-specific]
|
||||
* xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[#using.auto-configuration.packages]
|
||||
|
@ -43,7 +43,7 @@ You can also deploy Spring Boot applications to any servlet 5.0+ compatible cont
|
||||
[[getting-started.system-requirements.graal]]
|
||||
== GraalVM Native Images
|
||||
|
||||
Spring Boot applications can be xref:reference:native-image/introducing-graalvm-native-images.adoc[converted into a Native Image] using GraalVM {version-graal} or above.
|
||||
Spring Boot applications can be xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[converted into a Native Image] using GraalVM {version-graal} or above.
|
||||
|
||||
Images can be created using the https://github.com/graalvm/native-build-tools[native build tools] Gradle/Maven plugins or `native-image` tool provided by GraalVM.
|
||||
You can also create native images using the https://github.com/paketo-buildpacks/native-image[native-image Paketo buildpack].
|
||||
|
@ -1,4 +1,4 @@
|
||||
[[deployment.cloud]]
|
||||
[[howto.deployment.cloud]]
|
||||
= Deploying to the Cloud
|
||||
|
||||
Spring Boot's executable jars are ready-made for most popular cloud PaaS (Platform-as-a-Service) providers.
|
||||
@ -18,7 +18,7 @@ In this section, we look at what it takes to get the xref:tutorial:first-applica
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.cloud-foundry]]
|
||||
[[howto.deployment.cloud.cloud-foundry]]
|
||||
== Cloud Foundry
|
||||
|
||||
Cloud Foundry provides default buildpacks that come into play if no other buildpack is specified.
|
||||
@ -87,7 +87,7 @@ In the preceding example, you could find it at `\https://acloudyspringtime.cfapp
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.cloud-foundry.binding-to-services]]
|
||||
[[howto.deployment.cloud.cloud-foundry.binding-to-services]]
|
||||
=== Binding to Services
|
||||
|
||||
By default, metadata about the running application as well as service connection information is exposed to the application as environment variables (for example: `$VCAP_SERVICES`).
|
||||
@ -106,17 +106,17 @@ TIP: The https://github.com/pivotal-cf/java-cfenv/[Java CFEnv] project is a bett
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.kubernetes]]
|
||||
[[howto.deployment.cloud.kubernetes]]
|
||||
== Kubernetes
|
||||
|
||||
Spring Boot auto-detects Kubernetes deployment environments by checking the environment for `"*_SERVICE_HOST"` and `"*_SERVICE_PORT"` variables.
|
||||
You can override this detection with the configprop:spring.main.cloud-platform[] configuration property.
|
||||
|
||||
Spring Boot helps you to xref:features/spring-application.adoc#features.spring-application.application-availability[manage the state of your application] and export it with xref:actuator/endpoints.adoc#actuator.endpoints.kubernetes-probes[HTTP Kubernetes Probes using Actuator].
|
||||
Spring Boot helps you to xref:reference:features/spring-application.adoc#features.spring-application.application-availability[manage the state of your application] and export it with xref:reference:actuator/endpoints.adoc#actuator.endpoints.kubernetes-probes[HTTP Kubernetes Probes using Actuator].
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.kubernetes.container-lifecycle]]
|
||||
[[howto.deployment.cloud.kubernetes.container-lifecycle]]
|
||||
=== Kubernetes Container Lifecycle
|
||||
|
||||
When Kubernetes deletes an application instance, the shutdown process involves several subsystems concurrently: shutdown hooks, unregistering the service, removing the instance from the load-balancer...
|
||||
@ -138,7 +138,7 @@ spec:
|
||||
command: ["sh", "-c", "sleep 10"]
|
||||
----
|
||||
|
||||
Once the pre-stop hook has completed, SIGTERM will be sent to the container and xref:web/graceful-shutdown.adoc[graceful shutdown] will begin, allowing any remaining in-flight requests to complete.
|
||||
Once the pre-stop hook has completed, SIGTERM will be sent to the container and xref:reference:web/graceful-shutdown.adoc[graceful shutdown] will begin, allowing any remaining in-flight requests to complete.
|
||||
|
||||
NOTE: When Kubernetes sends a SIGTERM signal to the pod, it waits for a specified time called the termination grace period (the default for which is 30 seconds).
|
||||
If the containers are still running after the grace period, they are sent the SIGKILL signal and forcibly removed.
|
||||
@ -146,7 +146,7 @@ If the pod takes longer than 30 seconds to shut down, which could be because you
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.heroku]]
|
||||
[[howto.deployment.cloud.heroku]]
|
||||
== Heroku
|
||||
|
||||
Heroku is another popular PaaS platform.
|
||||
@ -221,7 +221,7 @@ For more details, see https://devcenter.heroku.com/articles/deploying-spring-boo
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.openshift]]
|
||||
[[howto.deployment.cloud.openshift]]
|
||||
== OpenShift
|
||||
|
||||
https://www.openshift.com/[OpenShift] has many resources describing how to deploy Spring Boot applications, including:
|
||||
@ -233,7 +233,7 @@ https://www.openshift.com/[OpenShift] has many resources describing how to deplo
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.aws]]
|
||||
[[howto.deployment.cloud.aws]]
|
||||
== Amazon Web Services (AWS)
|
||||
|
||||
Amazon Web Services offers multiple ways to install Spring Boot-based applications, either as traditional web applications (war) or as executable jar files with an embedded web server.
|
||||
@ -250,7 +250,7 @@ In this document, we describe to approach using AWS Elastic Beanstalk.
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.aws.beanstalk]]
|
||||
[[howto.deployment.cloud.aws.beanstalk]]
|
||||
=== AWS Elastic Beanstalk
|
||||
|
||||
As described in the official https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html[Elastic Beanstalk Java guide], there are two main options to deploy a Java application.
|
||||
@ -258,7 +258,7 @@ You can either use the "`Tomcat Platform`" or the "`Java SE platform`".
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.aws.beanstalk.tomcat-platform]]
|
||||
[[howto.deployment.cloud.aws.beanstalk.tomcat-platform]]
|
||||
==== Using the Tomcat Platform
|
||||
|
||||
This option applies to Spring Boot projects that produce a war file.
|
||||
@ -267,7 +267,7 @@ You need only follow the official guide.
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.aws.beanstalk.java-se-platform]]
|
||||
[[howto.deployment.cloud.aws.beanstalk.java-se-platform]]
|
||||
==== Using the Java SE Platform
|
||||
|
||||
This option applies to Spring Boot projects that produce a jar file and run an embedded web container.
|
||||
@ -311,7 +311,7 @@ eb create -s
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.aws.summary]]
|
||||
[[howto.deployment.cloud.aws.summary]]
|
||||
=== Summary
|
||||
|
||||
This is one of the easiest ways to get to AWS, but there are more things to cover, such as how to integrate Elastic Beanstalk into any CI / CD tool, use the Elastic Beanstalk Maven plugin instead of the CLI, and others.
|
||||
@ -319,7 +319,7 @@ There is a https://exampledriven.wordpress.com/2017/01/09/spring-boot-aws-elasti
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.boxfuse]]
|
||||
[[howto.deployment.cloud.boxfuse]]
|
||||
== CloudCaptain and Amazon Web Services
|
||||
|
||||
https://cloudcaptain.sh/[CloudCaptain] works by turning your Spring Boot executable jar or war into a minimal VM image that can be deployed unchanged either on VirtualBox or on AWS.
|
||||
@ -368,14 +368,14 @@ See the blog post on https://cloudcaptain.sh/blog/spring-boot-ec2.html[deploying
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.azure]]
|
||||
[[howto.deployment.cloud.azure]]
|
||||
== Azure
|
||||
|
||||
This https://spring.io/guides/gs/spring-boot-for-azure/[Getting Started guide] walks you through deploying your Spring Boot application to either https://azure.microsoft.com/en-us/services/spring-cloud/[Azure Spring Cloud] or https://docs.microsoft.com/en-us/azure/app-service/overview[Azure App Service].
|
||||
|
||||
|
||||
|
||||
[[deployment.cloud.google]]
|
||||
[[howto.deployment.cloud.google]]
|
||||
== Google Cloud
|
||||
|
||||
Google Cloud has several options that can be used to launch Spring Boot applications.
|
@ -1,4 +1,4 @@
|
||||
[[deployment]]
|
||||
[[howto.deployment]]
|
||||
= Deploying Spring Boot Applications
|
||||
|
||||
Spring Boot's flexible packaging options provide a great deal of choice when it comes to deploying your application.
|
@ -1,11 +1,11 @@
|
||||
[[deployment.installing]]
|
||||
[[howto.deployment.installing]]
|
||||
= Installing Spring Boot Applications
|
||||
|
||||
In addition to running Spring Boot applications by using `java -jar` directly, it is also possible to run them as `systemd`, `init.d` or Windows services.
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.system-d]]
|
||||
[[howto.deployment.installing.system-d]]
|
||||
== Installation as a systemd Service
|
||||
|
||||
`systemd` is the successor of the System V init system and is now being used by many modern Linux distributions.
|
||||
@ -52,7 +52,7 @@ Run `man systemctl` for more details.
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d]]
|
||||
[[howto.deployment.installing.init-d]]
|
||||
== Installation as an init.d Service (System V)
|
||||
|
||||
To use your application as `init.d` service, configure its build to produce a xref:deployment/installing.adoc[fully executable jar].
|
||||
@ -125,7 +125,7 @@ $ update-rc.d myapp defaults <priority>
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d.securing]]
|
||||
[[howto.deployment.installing.init-d.securing]]
|
||||
=== Securing an init.d Service
|
||||
|
||||
NOTE: The following is a set of guidelines on how to secure a Spring Boot application that runs as an init.d service.
|
||||
@ -165,7 +165,7 @@ $ sudo chattr +i your-app.jar
|
||||
|
||||
This will prevent any user, including root, from modifying the jar.
|
||||
|
||||
If root is used to control the application's service and you xref:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-running.conf-file[use a `.conf` file] to customize its startup, the `.conf` file is read and evaluated by the root user.
|
||||
If root is used to control the application's service and you xref:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-running.conf-file[use a `.conf` file] to customize its startup, the `.conf` file is read and evaluated by the root user.
|
||||
It should be secured accordingly.
|
||||
Use `chmod` so that the file can only be read by the owner and use `chown` to make root the owner, as shown in the following example:
|
||||
|
||||
@ -177,7 +177,7 @@ $ sudo chown root:root your-app.conf
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d.script-customization]]
|
||||
[[howto.deployment.installing.init-d.script-customization]]
|
||||
=== Customizing the Startup Script
|
||||
|
||||
The default embedded startup script written by the Maven or Gradle plugin can be customized in a number of ways.
|
||||
@ -186,7 +186,7 @@ If you find you cannot customize something that you need to, use the `embeddedLa
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d.script-customization.when-written]]
|
||||
[[howto.deployment.installing.init-d.script-customization.when-written]]
|
||||
==== Customizing the Start Script When It Is Written
|
||||
|
||||
It often makes sense to customize elements of the start script as it is written into the jar file.
|
||||
@ -295,10 +295,10 @@ The following property substitutions are supported with the default script:
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d.script-customization.when-running]]
|
||||
[[howto.deployment.installing.init-d.script-customization.when-running]]
|
||||
==== Customizing a Script When It Runs
|
||||
|
||||
For items of the script that need to be customized _after_ the jar has been written, you can use environment variables or a xref:deployment/installing.adoc#deployment.installing.init-d.script-customization.when-running.conf-file[config file].
|
||||
For items of the script that need to be customized _after_ the jar has been written, you can use environment variables or a xref:deployment/installing.adoc#howto.deployment.installing.init-d.script-customization.when-running.conf-file[config file].
|
||||
|
||||
The following environment properties are supported with the default script:
|
||||
|
||||
@ -361,7 +361,7 @@ See the https://www.freedesktop.org/software/systemd/man/systemd.service.html[se
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.init-d.script-customization.when-running.conf-file]]
|
||||
[[howto.deployment.installing.init-d.script-customization.when-running.conf-file]]
|
||||
===== Using a Conf File
|
||||
|
||||
With the exception of `JARFILE` and `APP_NAME`, the settings listed in the preceding section can be configured by using a `.conf` file.
|
||||
@ -377,11 +377,11 @@ LOG_FOLDER=/custom/log/folder
|
||||
|
||||
TIP: If you do not like having the config file next to the jar file, you can set a `CONF_FOLDER` environment variable to customize the location of the config file.
|
||||
|
||||
To learn about securing this file appropriately, see xref:deployment/installing.adoc#deployment.installing.init-d.securing[the guidelines for securing an init.d service].
|
||||
To learn about securing this file appropriately, see xref:deployment/installing.adoc#howto.deployment.installing.init-d.securing[the guidelines for securing an init.d service].
|
||||
|
||||
|
||||
|
||||
[[deployment.installing.windows-services]]
|
||||
[[howto.deployment.installing.windows-services]]
|
||||
== Microsoft Windows Services
|
||||
|
||||
A Spring Boot application can be started as a Windows service by using https://github.com/kohsuke/winsw[`winsw`].
|
@ -1,23 +1,21 @@
|
||||
[[native-image.developing-your-first-application]]
|
||||
[[howto.native-image.developing-your-first-application]]
|
||||
= Developing Your First GraalVM Native Application
|
||||
|
||||
Now that we have a good overview of GraalVM Native Images and how the Spring ahead-of-time engine works, we can look at how to create an application.
|
||||
|
||||
There are two main ways to build a Spring Boot native image application:
|
||||
|
||||
* Using Spring Boot support for Cloud Native Buildpacks to generate a lightweight container containing a native executable.
|
||||
* Using Spring Boot xref:reference:packaging/container-images/cloud-native-buildpacks.adoc[support for Cloud Native Buildpacks] with the https://paketo.io/docs/reference/java-native-image-reference/[Paketo Java Native Image buildpack] to generate a lightweight container containing a native executable.
|
||||
* Using GraalVM Native Build Tools to generate a native executable.
|
||||
|
||||
TIP: The easiest way to start a new native Spring Boot project is to go to https://start.spring.io[start.spring.io], add the "`GraalVM Native Support`" dependency and generate the project.
|
||||
TIP: The easiest way to start a new native Spring Boot project is to go to https://start.spring.io[start.spring.io], add the `GraalVM Native Support` dependency and generate the project.
|
||||
The included `HELP.md` file will provide getting started hints.
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.sample-application]]
|
||||
[[howto.native-image.developing-your-first-application.sample-application]]
|
||||
== Sample Application
|
||||
|
||||
We need an example application that we can use to create our native image.
|
||||
For our purposes, the simple "`Hello World!`" web application that's covered in the "`xref:tutorial:first-application/index.adoc[Developing Your First Spring Boot Application]`" section will suffice.
|
||||
For our purposes, the simple "Hello World!" web application that's covered in the xref:tutorial:first-application/index.adoc[Developing Your First Spring Boot Application] section will suffice.
|
||||
|
||||
To recap, our main application code looks like this:
|
||||
|
||||
@ -27,20 +25,20 @@ This application uses Spring MVC and embedded Tomcat, both of which have been te
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.buildpacks]]
|
||||
[[howto.native-image.developing-your-first-application.buildpacks]]
|
||||
== Building a Native Image Using Buildpacks
|
||||
|
||||
Spring Boot includes buildpack support for native images directly for both Maven and Gradle.
|
||||
Spring Boot supports building Docker images containing native executables, using Cloud Native Buildpacks (CNB) integration with both Maven and Gradle and the https://paketo.io/docs/reference/java-native-image-reference/[Paketo Java Native Image buildpack].
|
||||
This means you can just type a single command and quickly get a sensible image into your locally running Docker daemon.
|
||||
The resulting image doesn't contain a JVM, instead the native image is compiled statically.
|
||||
This leads to smaller images.
|
||||
|
||||
NOTE: The builder used for the images is `paketobuildpacks/builder-jammy-tiny:latest`.
|
||||
NOTE: The CNB builder used for the images is `paketobuildpacks/builder-jammy-tiny:latest`.
|
||||
It has small footprint and reduced attack surface, but you can also use `paketobuildpacks/builder-jammy-base:latest` or `paketobuildpacks/builder-jammy-full:latest` to have more tools available in the image if required.
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.buildpacks.system-requirements]]
|
||||
[[howto.native-image.developing-your-first-application.buildpacks.system-requirements]]
|
||||
=== System Requirements
|
||||
|
||||
Docker should be installed. See https://docs.docker.com/installation/#installation[Get Docker] for more details.
|
||||
@ -55,7 +53,7 @@ On Microsoft Windows, make sure to enable the https://docs.docker.com/docker-for
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.buildpacks.maven]]
|
||||
[[howto.native-image.developing-your-first-application.buildpacks.maven]]
|
||||
=== Using Maven
|
||||
|
||||
To build a native image container using Maven you should ensure that your `pom.xml` file uses the `spring-boot-starter-parent` and the `org.graalvm.buildtools:native-maven-plugin`.
|
||||
@ -94,7 +92,7 @@ $ mvn -Pnative spring-boot:build-image
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.buildpacks.gradle]]
|
||||
[[howto.native-image.developing-your-first-application.buildpacks.gradle]]
|
||||
=== Using Gradle
|
||||
|
||||
The Spring Boot Gradle plugin automatically configures AOT tasks when the GraalVM Native Image plugin is applied.
|
||||
@ -110,7 +108,7 @@ $ gradle bootBuildImage
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.buildpacks.running]]
|
||||
[[howto.native-image.developing-your-first-application.buildpacks.running]]
|
||||
=== Running the example
|
||||
|
||||
Once you have run the appropriate build command, a Docker image should be available.
|
||||
@ -151,7 +149,7 @@ To gracefully exit the application, press `ctrl-c`.
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools]]
|
||||
== Building a Native Image using Native Build Tools
|
||||
|
||||
If you want to generate a native executable directly without using Docker, you can use GraalVM Native Build Tools.
|
||||
@ -160,7 +158,7 @@ You can use them to perform a variety of GraalVM tasks, including generating a n
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.prerequisites]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.prerequisites]]
|
||||
=== Prerequisites
|
||||
|
||||
To build a native image using the Native Build Tools, you'll need a GraalVM distribution on your machine.
|
||||
@ -168,7 +166,7 @@ You can either download it manually on the {url-download-liberica-nik}[Liberica
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos]]
|
||||
==== Linux and macOS
|
||||
|
||||
To install the native image compiler on macOS or Linux, we recommend using SDKMAN!.
|
||||
@ -192,7 +190,7 @@ OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode)
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.prerequisites.windows]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.prerequisites.windows]]
|
||||
==== Windows
|
||||
|
||||
On Windows, follow https://medium.com/graalvm/using-graalvm-and-native-image-on-windows-10-9954dc071311[these instructions] to install either https://www.graalvm.org/downloads/[GraalVM] or {url-download-liberica-nik}[Liberica Native Image Kit] in version {version-graal}, the Visual Studio Build Tools and the Windows SDK.
|
||||
@ -200,10 +198,10 @@ Due to the https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-ex
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.maven]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.maven]]
|
||||
=== Using Maven
|
||||
|
||||
As with the xref:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.maven[buildpack support], you need to make sure that you're using `spring-boot-starter-parent` in order to inherit the `native` profile and that the `org.graalvm.buildtools:native-maven-plugin` plugin is used.
|
||||
As with the xref:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.maven[buildpacks support], you need to make sure that you're using `spring-boot-starter-parent` in order to inherit the `native` profile and that the `org.graalvm.buildtools:native-maven-plugin` plugin is used.
|
||||
|
||||
With the `native` profile active, you can invoke the `native:compile` goal to trigger `native-image` compilation:
|
||||
|
||||
@ -216,7 +214,7 @@ The native image executable can be found in the `target` directory.
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.gradle]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.gradle]]
|
||||
=== Using Gradle
|
||||
|
||||
When the Native Build Tools Gradle plugin is applied to your project, the Spring Boot Gradle plugin will automatically trigger the Spring AOT engine.
|
||||
@ -231,7 +229,7 @@ The native image executable can be found in the `build/native/nativeCompile` dir
|
||||
|
||||
|
||||
|
||||
[[native-image.developing-your-first-application.native-build-tools.running]]
|
||||
[[howto.native-image.developing-your-first-application.native-build-tools.running]]
|
||||
=== Running the Example
|
||||
|
||||
At this point, your application should work. You can now start the application by running it directly:
|
@ -0,0 +1,7 @@
|
||||
[[howto.native-image]]
|
||||
= GraalVM Native Applications
|
||||
|
||||
This section contains details on developing and testing Spring Boot applications as GraalVM native images.
|
||||
|
||||
TIP: For an overview of GraalVM native image concepts, see the xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[Introducing GraalVM Native Images] section.
|
||||
|
@ -1,4 +1,4 @@
|
||||
[[native-image.testing]]
|
||||
[[howto.native-image.testing]]
|
||||
= Testing GraalVM Native Images
|
||||
|
||||
When writing native image applications, we recommend that you continue to use the JVM whenever possible to develop the majority of your unit and integration tests.
|
||||
@ -13,7 +13,7 @@ For native image testing, you're generally looking to ensure that the following
|
||||
|
||||
|
||||
|
||||
[[native-image.testing.with-the-jvm]]
|
||||
[[howto.native-image.testing.with-the-jvm]]
|
||||
== Testing Ahead-of-time Processing With the JVM
|
||||
|
||||
When a Spring Boot application runs, it attempts to detect if it is running as a native image.
|
||||
@ -45,7 +45,7 @@ Or you might consider using a project like Selenium to check your application's
|
||||
|
||||
|
||||
|
||||
[[native-image.testing.with-native-build-tools]]
|
||||
[[howto.native-image.testing.with-native-build-tools]]
|
||||
== Testing With Native Build Tools
|
||||
|
||||
GraalVM Native Build Tools includes the ability to run tests inside a native image.
|
||||
@ -58,7 +58,7 @@ For example, you might choose to run native tests once a day.
|
||||
Spring Framework includes ahead-of-time support for running tests.
|
||||
All the usual Spring testing features work with native image tests.
|
||||
For example, you can continue to use the `@SpringBootTest` annotation.
|
||||
You can also use Spring Boot xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-tests[test slices] to test only specific parts of your application.
|
||||
You can also use Spring Boot xref:reference:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-tests[test slices] to test only specific parts of your application.
|
||||
|
||||
Spring Framework's native testing support works in the following way:
|
||||
|
||||
@ -70,7 +70,7 @@ Spring Framework's native testing support works in the following way:
|
||||
|
||||
|
||||
|
||||
[[native-image.testing.with-native-build-tools.maven]]
|
||||
[[howto.native-image.testing.with-native-build-tools.maven]]
|
||||
=== Using Maven
|
||||
|
||||
To run native tests using Maven, ensure that your `pom.xml` file uses the `spring-boot-starter-parent`.
|
||||
@ -99,7 +99,7 @@ $ mvn -PnativeTest test
|
||||
|
||||
|
||||
|
||||
[[native-image.testing.with-native-build-tools.gradle]]
|
||||
[[howto.native-image.testing.with-native-build-tools.gradle]]
|
||||
=== Using Gradle
|
||||
|
||||
The Spring Boot Gradle plugin automatically configures AOT test tasks when the GraalVM Native Image plugin is applied.
|
@ -18,5 +18,11 @@
|
||||
** xref:how-to:testing.adoc[]
|
||||
** xref:how-to:build.adoc[]
|
||||
** xref:how-to:aot.adoc[]
|
||||
** xref:how-to:traditional-deployment.adoc[]
|
||||
** xref:how-to:native-image/index.adoc[]
|
||||
*** xref:how-to:native-image/developing-your-first-application.adoc[]
|
||||
*** xref:how-to:native-image/testing-native-applications.adoc[]
|
||||
** xref:how-to:deployment/index.adoc[]
|
||||
*** xref:how-to:deployment/traditional-deployment.adoc[]
|
||||
*** xref:how-to:deployment/cloud.adoc[]
|
||||
*** xref:how-to:deployment/installing.adoc[]
|
||||
** xref:how-to:docker-compose.adoc[]
|
||||
|
@ -935,7 +935,7 @@ readinessProbe:
|
||||
NOTE: `<actuator-port>` should be set to the port that the actuator endpoints are available on.
|
||||
It could be the main web server port or a separate management port if the `"management.server.port"` property has been set.
|
||||
|
||||
These health groups are automatically enabled only if the application xref:deployment/cloud.adoc#deployment.cloud.kubernetes[runs in a Kubernetes environment].
|
||||
These health groups are automatically enabled only if the application xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes[runs in a Kubernetes environment].
|
||||
You can enable them in any environment by using the configprop:management.endpoint.health.probes.enabled[] configuration property.
|
||||
|
||||
NOTE: If an application takes longer to start than the configured liveness period, Kubernetes mentions the `"startupProbe"` as a possible solution.
|
||||
@ -1062,7 +1062,7 @@ When a Spring Boot application shuts down:
|
||||
|The application context is closed and the application is shut down.
|
||||
|===
|
||||
|
||||
TIP: See xref:deployment/cloud.adoc#deployment.cloud.kubernetes.container-lifecycle[Kubernetes container lifecycle section] for more information about Kubernetes deployment.
|
||||
TIP: See xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes.container-lifecycle[Kubernetes container lifecycle section] for more information about Kubernetes deployment.
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
[[container-images]]
|
||||
= Container Images
|
||||
|
||||
Spring Boot applications can be containerized xref:container-images/dockerfiles.adoc[using Dockerfiles], or by xref:container-images/cloud-native-buildpacks.adoc[using Cloud Native Buildpacks to create optimized docker compatible container images that you can run anywhere].
|
@ -1,110 +0,0 @@
|
||||
[[deployment.efficient]]
|
||||
= Efficient Deployments
|
||||
|
||||
|
||||
|
||||
[[deployment.efficient.unpacking]]
|
||||
== Unpacking the Executable JAR
|
||||
|
||||
You can run your application using the executable jar, but loading the classes from nested jars has a small cost.
|
||||
Depending on the size of the jar, running the application from an exploded structure is faster and recommended in production.
|
||||
Certain PaaS implementations may also choose to extract archives before they run.
|
||||
For example, Cloud Foundry operates this way.
|
||||
|
||||
Spring Boot supports extracting your application to a directory using different layouts.
|
||||
The default layout is the most efficient, and is xref:#deployment.efficient.cds[CDS friendly].
|
||||
|
||||
In this layout, the libraries are extracted to a `lib/` folder, and the application JAR
|
||||
contains the application classes and a manifest which references the libraries in the `lib/` folder.
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Djarmode=tools -jar my-app.jar extract
|
||||
$ java -jar my-app/my-app.jar
|
||||
----
|
||||
|
||||
After startup, you should not expect any differences.
|
||||
|
||||
TIP: Run `java -Djarmode=tools -jar my-app.jar help extract` to see all possible options.
|
||||
|
||||
|
||||
[[deployment.efficient.cds]]
|
||||
== Optimize Startup Time with CDS
|
||||
|
||||
Class Data Sharing (CDS) is a https://docs.oracle.com/en/java/javase/17/vm/class-data-sharing.html[JVM feature] that can help reduce the startup time and memory footprint of Java applications.
|
||||
|
||||
To use it, you should first perform a training run on your application in exploded form:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Djarmode=tools -jar my-app.jar extract --destination application
|
||||
$ cd application
|
||||
$ java -XX:ArchiveClassesAtExit=application.jsa -Dspring.context.exit=onRefresh -jar my-app.jar
|
||||
----
|
||||
|
||||
This creates an `application.jsa` file that can be reused as long as the application is not updated.
|
||||
|
||||
To use the cache, you need to add an extra parameter when starting the application:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -XX:SharedArchiveFile=application.jsa -jar my-app.jar
|
||||
----
|
||||
|
||||
NOTE: For more details about CDS, refer to the {url-spring-framework-docs}/integration/cds.html[Spring Framework reference documentation]
|
||||
|
||||
|
||||
[[deployment.efficient.aot]]
|
||||
== Using Ahead-of-time Processing With the JVM
|
||||
|
||||
It's beneficial for the startup time to run your application using the AOT generated initialization code.
|
||||
First, you need to ensure that the jar you are building includes AOT generated code.
|
||||
|
||||
NOTE: CDS and AOT can be combined to further improve startup time.
|
||||
|
||||
For Maven, this means that you should build with `-Pnative` to activate the `native` profile:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ mvn -Pnative package
|
||||
----
|
||||
|
||||
For Gradle, you need to ensure that your build includes the `org.springframework.boot.aot` plugin.
|
||||
|
||||
When the JAR has been built, run it with `spring.aot.enabled` system property set to `true`. For example:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Dspring.aot.enabled=true -jar myapplication.jar
|
||||
|
||||
........ Starting AOT-processed MyApplication ...
|
||||
----
|
||||
|
||||
Beware that using the ahead-of-time processing has drawbacks.
|
||||
It implies the following restrictions:
|
||||
|
||||
* The classpath is fixed and fully defined at build time
|
||||
* The beans defined in your application cannot change at runtime, meaning:
|
||||
- The Spring `@Profile` annotation and profile-specific configuration xref:how-to:aot.adoc#howto.aot.conditions[have limitations].
|
||||
- Properties that change if a bean is created are not supported (for example, `@ConditionalOnProperty` and `.enable` properties).
|
||||
|
||||
To learn more about ahead-of-time processing, please see the xref:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing[Understanding Spring Ahead-of-Time Processing section].
|
||||
|
||||
|
||||
|
||||
[[deployment.efficient.checkpoint-restore]]
|
||||
== Checkpoint and Restore With the JVM
|
||||
|
||||
https://wiki.openjdk.org/display/crac/Main[Coordinated Restore at Checkpoint] (CRaC) is an OpenJDK project that defines a new Java API to allow you to checkpoint and restore an application on the HotSpot JVM.
|
||||
It is based on https://github.com/checkpoint-restore/criu[CRIU], a project that implements checkpoint/restore functionality on Linux.
|
||||
|
||||
The principle is the following: you start your application almost as usual but with a CRaC enabled version of the JDK like https://bell-sw.com/pages/downloads/?package=jdk-crac[BellSoft Liberica JDK with CRaC] or https://www.azul.com/downloads/?package=jdk-crac#zulu[Azul Zulu JDK with CRaC].
|
||||
Then at some point, potentially after some workloads that will warm up your JVM by executing all common code paths, you trigger a checkpoint using an API call, a `jcmd` command, an HTTP endpoint, or a different mechanism.
|
||||
|
||||
A memory representation of the running JVM, including its warmness, is then serialized to disk, allowing a fast restoration at a later point, potentially on another machine with a similar operating system and CPU architecture.
|
||||
The restored process retains all the capabilities of the HotSpot JVM, including further JIT optimizations at runtime.
|
||||
|
||||
Based on the foundations provided by Spring Framework, Spring Boot provides support for checkpointing and restoring your application, and manages out-of-the-box the lifecycle of resources such as socket, files and thread pools https://github.com/spring-projects/spring-lifecycle-smoke-tests/blob/main/STATUS.adoc[on a limited scope].
|
||||
Additional lifecycle management is expected for other dependencies and potentially for the application code dealing with such resources.
|
||||
|
||||
You can find more details about the two modes supported ("on demand checkpoint/restore of a running application" and "automatic checkpoint/restore at startup"), how to enable checkpoint and restore support and some guidelines in {url-spring-framework-docs}/integration/checkpoint-restore.html[the Spring Framework JVM Checkpoint Restore support documentation].
|
@ -230,7 +230,7 @@ We can also update the state of the application, when the application breaks and
|
||||
include-code::MyLocalCacheVerifier[]
|
||||
|
||||
Spring Boot provides xref:actuator/endpoints.adoc#actuator.endpoints.kubernetes-probes[Kubernetes HTTP probes for "Liveness" and "Readiness" with Actuator Health Endpoints].
|
||||
You can get more guidance about xref:deployment/cloud.adoc#deployment.cloud.kubernetes[deploying Spring Boot applications on Kubernetes in the dedicated section].
|
||||
You can get more guidance about xref:how-to:deployment/cloud.adoc#howto.deployment.cloud.kubernetes[deploying Spring Boot applications on Kubernetes in the dedicated section].
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
= Reference
|
||||
|
||||
This section provides information on using the feature and capabilities of Spring Boot.
|
||||
This section provides information on using the features and capabilities of Spring Boot.
|
||||
|
@ -0,0 +1,35 @@
|
||||
[[packaging.aot]]
|
||||
= Ahead-of-time Processing With the JVM
|
||||
|
||||
It's beneficial for the startup time to run your application using the AOT generated initialization code.
|
||||
First, you need to ensure that the jar you are building includes AOT generated code.
|
||||
|
||||
NOTE: CDS and AOT can be combined to further improve startup time.
|
||||
|
||||
For Maven, this means that you should build with `-Pnative` to activate the `native` profile:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ mvn -Pnative package
|
||||
----
|
||||
|
||||
For Gradle, you need to ensure that your build includes the `org.springframework.boot.aot` plugin.
|
||||
|
||||
When the JAR has been built, run it with `spring.aot.enabled` system property set to `true`. For example:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Dspring.aot.enabled=true -jar myapplication.jar
|
||||
|
||||
........ Starting AOT-processed MyApplication ...
|
||||
----
|
||||
|
||||
Beware that using the ahead-of-time processing has drawbacks.
|
||||
It implies the following restrictions:
|
||||
|
||||
* The classpath is fixed and fully defined at build time
|
||||
* The beans defined in your application cannot change at runtime, meaning:
|
||||
- The Spring `@Profile` annotation and profile-specific configuration xref:how-to:aot.adoc#howto.aot.conditions[have limitations].
|
||||
- Properties that change if a bean is created are not supported (for example, `@ConditionalOnProperty` and `.enable` properties).
|
||||
|
||||
To learn more about ahead-of-time processing, please see the xref:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing[Understanding Spring Ahead-of-Time Processing] section.
|
@ -0,0 +1,16 @@
|
||||
[[packaging.checkpoint-restore]]
|
||||
= Checkpoint and Restore With the JVM
|
||||
|
||||
https://wiki.openjdk.org/display/crac/Main[Coordinated Restore at Checkpoint] (CRaC) is an OpenJDK project that defines a new Java API to allow you to checkpoint and restore an application on the HotSpot JVM.
|
||||
It is based on https://github.com/checkpoint-restore/criu[CRIU], a project that implements checkpoint/restore functionality on Linux.
|
||||
|
||||
The principle is the following: you start your application almost as usual but with a CRaC enabled version of the JDK like https://bell-sw.com/pages/downloads/?package=jdk-crac[BellSoft Liberica JDK with CRaC] or https://www.azul.com/downloads/?package=jdk-crac#zulu[Azul Zulu JDK with CRaC].
|
||||
Then at some point, potentially after some workloads that will warm up your JVM by executing all common code paths, you trigger a checkpoint using an API call, a `jcmd` command, an HTTP endpoint, or a different mechanism.
|
||||
|
||||
A memory representation of the running JVM, including its warmness, is then serialized to disk, allowing a fast restoration at a later point, potentially on another machine with a similar operating system and CPU architecture.
|
||||
The restored process retains all the capabilities of the HotSpot JVM, including further JIT optimizations at runtime.
|
||||
|
||||
Based on the foundations provided by Spring Framework, Spring Boot provides support for checkpointing and restoring your application, and manages out-of-the-box the lifecycle of resources such as socket, files and thread pools https://github.com/spring-projects/spring-lifecycle-smoke-tests/blob/main/STATUS.adoc[on a limited scope].
|
||||
Additional lifecycle management is expected for other dependencies and potentially for the application code dealing with such resources.
|
||||
|
||||
You can find more details about the two modes supported ("on demand checkpoint/restore of a running application" and "automatic checkpoint/restore at startup"), how to enable checkpoint and restore support and some guidelines in {url-spring-framework-docs}/integration/checkpoint-restore.html[the Spring Framework JVM Checkpoint Restore support documentation].
|
@ -0,0 +1,24 @@
|
||||
[[packaging.class-data-sharing]]
|
||||
= Class Data Sharing
|
||||
|
||||
Class Data Sharing (CDS) is a https://docs.oracle.com/en/java/javase/17/vm/class-data-sharing.html[JVM feature] that can help reduce the startup time and memory footprint of Java applications.
|
||||
|
||||
To use it, you should first perform a training run on your application in exploded form:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Djarmode=tools -jar my-app.jar extract --destination application
|
||||
$ cd application
|
||||
$ java -XX:ArchiveClassesAtExit=application.jsa -Dspring.context.exit=onRefresh -jar my-app.jar
|
||||
----
|
||||
|
||||
This creates an `application.jsa` file that can be reused as long as the application is not updated.
|
||||
|
||||
To use the cache, you need to add an extra parameter when starting the application:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -XX:SharedArchiveFile=application.jsa -jar my-app.jar
|
||||
----
|
||||
|
||||
NOTE: For more details about CDS, refer to the {url-spring-framework-docs}/integration/cds.html[Spring Framework reference documentation]
|
@ -1,8 +1,7 @@
|
||||
[[container-images.buildpacks]]
|
||||
[[packaging.container-images.buildpacks]]
|
||||
= Cloud Native Buildpacks
|
||||
|
||||
Dockerfiles are just one way to build docker images.
|
||||
Another way to build docker images is directly from your Maven or Gradle plugin, using buildpacks.
|
||||
Docker images can be built directly from your Maven or Gradle plugin using https://buildpacks.io[Cloud Native Buildpacks].
|
||||
If you’ve ever used an application platform such as Cloud Foundry or Heroku then you’ve probably used a buildpack.
|
||||
Buildpacks are the part of the platform that takes your application and converts it into something that the platform can actually run.
|
||||
For example, Cloud Foundry’s Java buildpack will notice that you’re pushing a `.jar` file and automatically add a relevant JRE.
|
||||
@ -13,8 +12,8 @@ This means you can just type a single command and quickly get a sensible image i
|
||||
|
||||
See the individual plugin documentation on how to use buildpacks with xref:maven-plugin:build-image.adoc#build-image[Maven] and xref:gradle-plugin:packaging-oci-image.adoc[Gradle].
|
||||
|
||||
NOTE: The https://github.com/paketo-buildpacks/spring-boot[Paketo Spring Boot buildpack] supports the `layers.idx` file, so any customization that is applied to it will be reflected in the image created by the buildpack.
|
||||
NOTE: The https://github.com/paketo-buildpacks/spring-boot[Paketo Spring Boot buildpack] supports the `layers.idx` file, so any xref:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images.layering[layer customization] that is applied to it will be reflected in the image created by the buildpacks.
|
||||
|
||||
NOTE: In order to achieve reproducible builds and container image caching, Buildpacks can manipulate the application resources metadata (such as the file "last modified" information).
|
||||
NOTE: In order to achieve reproducible builds and container image caching, buildpacks can manipulate the application resources metadata (such as the file "last modified" information).
|
||||
You should ensure that your application does not rely on that metadata at runtime.
|
||||
Spring Boot can use that information when serving static resources, but this can be disabled with configprop:spring.web.resources.cache.use-last-modified[].
|
@ -1,11 +1,11 @@
|
||||
[[container-images.dockerfiles]]
|
||||
[[packaging.container-images.dockerfiles]]
|
||||
= Dockerfiles
|
||||
|
||||
While it is possible to convert a Spring Boot uber jar into a docker image with just a few lines in the Dockerfile, we will use the xref:container-images/efficient-images.adoc#container-images.efficient-images.layering[layering feature] to create an optimized docker image.
|
||||
While it is possible to convert a Spring Boot uber jar into a Docker image with just a few lines in the Dockerfile, using the xref:packaging/container-images/efficient-images.adoc#packaging.container-images.efficient-images.layering[layering feature] will result in an optimized image.
|
||||
When you create a jar containing the layers index file, the `spring-boot-jarmode-tools` jar will be added as a dependency to your jar.
|
||||
With this jar on the classpath, you can launch your application in a special mode which allows the bootstrap code to run something entirely different from your application, for example, something that extracts the layers.
|
||||
|
||||
CAUTION: The `tools` mode can not be used with a xref:deployment/installing.adoc[fully executable Spring Boot archive] that includes a launch script.
|
||||
CAUTION: The `tools` mode can not be used with a xref:how-to:deployment/installing.adoc[fully executable Spring Boot archive] that includes a launch script.
|
||||
Disable launch script configuration when building a jar file that is intended to be used with `layertools`.
|
||||
|
||||
Here’s how you can launch your jar with a `tools` jar mode:
|
||||
@ -28,7 +28,7 @@ Available commands:
|
||||
help Help about any command
|
||||
----
|
||||
|
||||
The `extract` command can be used to easily split the application into layers to be added to the dockerfile.
|
||||
The `extract` command can be used to easily split the application into layers to be added to the Dockerfile.
|
||||
Here is an example of a Dockerfile using `jarmode`.
|
||||
|
||||
[source,dockerfile]
|
||||
@ -48,17 +48,17 @@ COPY --from=builder /builder/extracted/application/ ./
|
||||
ENTRYPOINT ["java", "-jar", "application.jar"]
|
||||
----
|
||||
|
||||
Assuming the above `Dockerfile` is in the current directory, your docker image can be built with `docker build .`, or optionally specifying the path to your application jar, as shown in the following example:
|
||||
Assuming the above `Dockerfile` is in the current directory, your Docker image can be built with `docker build .`, or optionally specifying the path to your application jar, as shown in the following example:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ docker build --build-arg JAR_FILE=path/to/myapp.jar .
|
||||
----
|
||||
|
||||
This is a multi-stage dockerfile.
|
||||
This is a multi-stage Dockerfile.
|
||||
The builder stage extracts the directories that are needed later.
|
||||
Each of the `COPY` commands relates to the layers extracted by the jarmode.
|
||||
|
||||
Of course, a Dockerfile can be written without using the jarmode.
|
||||
You can use some combination of `unzip` and `mv` to move things to the right layer but jarmode simplifies that.
|
||||
Additionally, the layout created by the jarmode is CDS friendly out of the box.
|
||||
Of course, a Dockerfile can be written without using the `jarmode`.
|
||||
You can use some combination of `unzip` and `mv` to move things to the right layer but `jarmode` simplifies that.
|
||||
Additionally, the layout created by the `jarmode` is CDS friendly out of the box.
|
@ -1,16 +1,16 @@
|
||||
[[container-images.efficient-images]]
|
||||
[[packaging.container-images.efficient-images]]
|
||||
= Efficient Container Images
|
||||
|
||||
It is easily possible to package a Spring Boot uber jar as a docker image.
|
||||
However, there are various downsides to copying and running the uber jar as is in the docker image.
|
||||
There’s always a certain amount of overhead when running a uber jar without unpacking it, and in a containerized environment this can be noticeable.
|
||||
The other issue is that putting your application's code and all its dependencies in one layer in the Docker image is sub-optimal.
|
||||
It is easily possible to package a Spring Boot uber jar as a Docker image.
|
||||
However, there are various downsides to copying and running the uber jar as-is in the Docker image.
|
||||
There’s always a certain amount of overhead when running an uber jar without unpacking it, and in a containerized environment this can be noticeable.
|
||||
The other issue is that putting your application's code and all its dependencies in one layer in the Docker image is not optimal.
|
||||
Since you probably recompile your code more often than you upgrade the version of Spring Boot you use, it’s often better to separate things a bit more.
|
||||
If you put jar files in the layer before your application classes, Docker often only needs to change the very bottom layer and can pick others up from its cache.
|
||||
|
||||
|
||||
|
||||
[[container-images.efficient-images.layering]]
|
||||
[[packaging.container-images.efficient-images.layering]]
|
||||
== Layering Docker Images
|
||||
|
||||
To make it easier to create optimized Docker images, Spring Boot supports adding a layer index file to the jar.
|
@ -0,0 +1,4 @@
|
||||
[[packaging.container-images]]
|
||||
= Container Images
|
||||
|
||||
Spring Boot applications can be containerized xref:packaging/container-images/dockerfiles.adoc[using Dockerfiles], or by xref:packaging/container-images/cloud-native-buildpacks.adoc[using Cloud Native Buildpacks] to create optimized docker compatible container images that you can run anywhere.
|
@ -0,0 +1,30 @@
|
||||
[[packaging.efficient]]
|
||||
= Efficient Deployments
|
||||
|
||||
|
||||
|
||||
[[packaging.efficient.unpacking]]
|
||||
== Unpacking the Executable JAR
|
||||
|
||||
You can run your application using the executable jar, but loading the classes from nested jars has a small startup cost.
|
||||
Depending on the size of the jar, running the application from an exploded structure is faster and recommended in production.
|
||||
Certain PaaS implementations may also choose to extract archives before they run.
|
||||
For example, Cloud Foundry operates this way.
|
||||
|
||||
Spring Boot supports extracting your application to a directory using different layouts.
|
||||
The default layout is the most efficient, and is xref:#deployment.efficient.cds[CDS friendly].
|
||||
|
||||
In this layout, the libraries are extracted to a `lib/` folder, and the application JAR
|
||||
contains the application classes and a manifest which references the libraries in the `lib/` folder.
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
$ java -Djarmode=tools -jar my-app.jar extract
|
||||
$ java -jar my-app/my-app.jar
|
||||
----
|
||||
|
||||
After startup, you should not expect any differences in execution time between running an executable jar and running an extracted jar.
|
||||
|
||||
TIP: Run `java -Djarmode=tools -jar my-app.jar help extract` to see all possible options.
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
[[packaging]]
|
||||
= Packaging Spring Boot Applications
|
||||
|
||||
Spring Boot supports several technologies for optimizing applications for deployment, including xref:packaging/native-image/index.adoc[GraalVM native images], xref:packaging/class-data-sharing.adoc[Class Data Sharing], and xref:packaging/checkpoint-restore.adoc[Checkpoint and Restore].
|
||||
|
||||
Spring Boot applications can be packaged in Docker containers using techniques described in xref:packaging/container-images/index.adoc[Container Images].
|
||||
|
@ -1,9 +1,9 @@
|
||||
[[native-image.advanced]]
|
||||
[[packaging.native-image.advanced]]
|
||||
= Advanced Native Images Topics
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.nested-configuration-properties]]
|
||||
[[packaging.native-image.advanced.nested-configuration-properties]]
|
||||
== Nested Configuration Properties
|
||||
|
||||
Reflection hints are automatically created for configuration properties by the Spring ahead-of-time engine.
|
||||
@ -34,7 +34,7 @@ NOTE: Please use public getters and setters in all cases, otherwise the properti
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.converting-executable-jars]]
|
||||
[[packaging.native-image.advanced.converting-executable-jars]]
|
||||
== Converting a Spring Boot Executable Jar
|
||||
|
||||
It is possible to convert a Spring Boot xref:specification:executable-jar/index.adoc[executable jar] into a native image as long as the jar contains the AOT generated assets.
|
||||
@ -49,7 +49,7 @@ NOTE: Your executable jar must include AOT generated assets such as generated cl
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.converting-executable-jars.buildpacks]]
|
||||
[[packaging.native-image.advanced.converting-executable-jars.buildpacks]]
|
||||
=== Using Buildpacks
|
||||
|
||||
Spring Boot applications usually use Cloud Native Buildpacks through the Maven (`mvn spring-boot:build-image`) or Gradle (`gradle bootBuildImage`) integrations.
|
||||
@ -82,7 +82,7 @@ $ docker run --rm -p 8080:8080 docker.io/library/myproject:0.0.1-SNAPSHOT
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.converting-executable-jars.native-image]]
|
||||
[[packaging.native-image.advanced.converting-executable-jars.native-image]]
|
||||
=== Using GraalVM native-image
|
||||
|
||||
Another option to turn an AOT processed Spring Boot executable jar into a native executable is to use the GraalVM `native-image` tool.
|
||||
@ -111,7 +111,7 @@ You need to ensure that all jars are listed (the command above uses `find` and `
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.using-the-tracing-agent]]
|
||||
[[packaging.native-image.advanced.using-the-tracing-agent]]
|
||||
== Using the Tracing Agent
|
||||
|
||||
The GraalVM native image {url-graal-docs-native-image}/metadata/AutomaticMetadataCollection[tracing agent] allows you to intercept reflection, resources or proxy usage on the JVM in order to generate the related hints.
|
||||
@ -130,7 +130,7 @@ To address this problem the agent supports an access-filter file that will cause
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.using-the-tracing-agent.launch]]
|
||||
[[packaging.native-image.advanced.using-the-tracing-agent.launch]]
|
||||
=== Launch the Application Directly
|
||||
|
||||
Use the following command to launch the application with the native image tracing agent attached:
|
||||
@ -154,7 +154,7 @@ For further reading, please see {url-graal-docs-native-image}/metadata/Automatic
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.custom-hints]]
|
||||
[[packaging.native-image.advanced.custom-hints]]
|
||||
== Custom Hints
|
||||
|
||||
If you need to provide your own hints for reflection, resources, serialization, proxy usage etc. you can use the `RuntimeHintsRegistrar` API.
|
||||
@ -170,7 +170,7 @@ But when you work with `WebClient`, `RestClient` or `RestTemplate` directly, you
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.custom-hints.testing]]
|
||||
[[packaging.native-image.advanced.custom-hints.testing]]
|
||||
=== Testing custom hints
|
||||
|
||||
The `RuntimeHintsPredicates` API can be used to test your hints.
|
||||
@ -182,7 +182,7 @@ include-code::MyRuntimeHintsTests[]
|
||||
|
||||
|
||||
|
||||
[[native-image.advanced.known-limitations]]
|
||||
[[packaging.native-image.advanced.known-limitations]]
|
||||
== Known Limitations
|
||||
|
||||
GraalVM native images are an evolving technology and not all libraries provide support.
|
@ -1,5 +1,5 @@
|
||||
[[native-image]]
|
||||
= GraalVM Native Image Support
|
||||
[[packaging.native-image]]
|
||||
= GraalVM Native Images
|
||||
|
||||
https://www.graalvm.org/native-image/[GraalVM Native Images] are standalone executables that can be generated by processing compiled Java applications ahead-of-time.
|
||||
Native Images generally have a smaller memory footprint and start faster than their JVM counterparts.
|
@ -1,4 +1,4 @@
|
||||
[[native-image.introducing-graalvm-native-images]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images]]
|
||||
= Introducing GraalVM Native Images
|
||||
|
||||
GraalVM Native Images provide a new way to deploy and run Java applications.
|
||||
@ -12,11 +12,11 @@ This ahead-of-time processing involves statically analyzing your application cod
|
||||
A GraalVM Native Image is a complete, platform-specific executable.
|
||||
You do not need to ship a Java Virtual Machine in order to run a native image.
|
||||
|
||||
TIP: If you just want to get started and experiment with GraalVM you can skip ahead to the "`xref:native-image/developing-your-first-application.adoc[Developing Your First GraalVM Native Application]`" section and return to this section later.
|
||||
TIP: If you just want to get started and experiment with GraalVM you can jump to the xref:how-to:native-image/developing-your-first-application.adoc[Developing Your First GraalVM Native Application] section and return to this section later.
|
||||
|
||||
|
||||
|
||||
[[native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments]]
|
||||
== Key Differences with JVM Deployments
|
||||
|
||||
The fact that GraalVM Native Images are produced ahead-of-time means that there are some key differences between native and JVM based applications.
|
||||
@ -29,14 +29,14 @@ The main differences are:
|
||||
* There is no lazy class loading, everything shipped in the executables will be loaded in memory on startup.
|
||||
* There are some limitations around some aspects of Java applications that are not fully supported.
|
||||
|
||||
On top of those differences, Spring uses a process called xref:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.understanding-aot-processing[Spring Ahead-of-Time processing], which imposes further limitations.
|
||||
On top of those differences, Spring uses a process called xref:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing[Spring Ahead-of-Time processing], which imposes further limitations.
|
||||
Please make sure to read at least the beginning of the next section to learn about those.
|
||||
|
||||
TIP: The {url-graal-docs-native-image}/metadata/Compatibility/[Native Image Compatibility Guide] section of the GraalVM reference documentation provides more details about GraalVM limitations.
|
||||
|
||||
|
||||
|
||||
[[native-image.introducing-graalvm-native-images.understanding-aot-processing]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing]]
|
||||
== Understanding Spring Ahead-of-Time Processing
|
||||
|
||||
Typical Spring Boot applications are quite dynamic and configuration is performed at runtime.
|
||||
@ -45,7 +45,7 @@ In fact, the concept of Spring Boot auto-configuration depends heavily on reacti
|
||||
Although it would be possible to tell GraalVM about these dynamic aspects of the application, doing so would undo most of the benefit of static analysis.
|
||||
So instead, when using Spring Boot to create native images, a closed-world is assumed and the dynamic aspects of the application are restricted.
|
||||
|
||||
A closed-world assumption implies, besides xref:native-image/introducing-graalvm-native-images.adoc#native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[the limitations created by GraalVM itself], the following restrictions:
|
||||
A closed-world assumption implies, besides xref:packaging/native-image/introducing-graalvm-native-images.adoc#packaging.native-image.introducing-graalvm-native-images.key-differences-with-jvm-deployments[the limitations created by GraalVM itself], the following restrictions:
|
||||
|
||||
* The beans defined in your application cannot change at runtime, meaning:
|
||||
- The Spring `@Profile` annotation and profile-specific configuration xref:how-to:aot.adoc#howto.aot.conditions[have limitations].
|
||||
@ -65,7 +65,7 @@ A Spring AOT processed application will typically generate:
|
||||
|
||||
|
||||
|
||||
[[native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation]]
|
||||
=== Source Code Generation
|
||||
|
||||
Spring applications are composed of Spring Beans.
|
||||
@ -112,7 +112,7 @@ Generated source files can be found in `target/spring-aot/main/sources` when usi
|
||||
|
||||
|
||||
|
||||
[[native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.hint-file-generation]]
|
||||
=== Hint File Generation
|
||||
|
||||
In addition to generating source files, the Spring AOT engine will also generate hint files that are used by GraalVM.
|
||||
@ -128,7 +128,7 @@ TIP: Generated hint files can be found in `target/spring-aot/main/resources` whe
|
||||
|
||||
|
||||
|
||||
[[native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation]]
|
||||
[[packaging.native-image.introducing-graalvm-native-images.understanding-aot-processing.proxy-class-generation]]
|
||||
=== Proxy Class Generation
|
||||
|
||||
Spring sometimes needs to generate proxy classes to enhance the code you've written with additional features.
|
@ -1,8 +1,9 @@
|
||||
[[using.packaging-for-production]]
|
||||
= Packaging Your Application for Production
|
||||
|
||||
Executable jars can be used for production deployment.
|
||||
As they are self-contained, they are also ideally suited for cloud-based deployment.
|
||||
Once your Spring Boot application is ready for production deployment, there are many options for packaging and optimizing
|
||||
the application.
|
||||
See the xref:packaging/index.adoc[Packaging] section of the documentation to read about these features.
|
||||
|
||||
For additional "`production ready`" features, such as health, auditing, and metric REST or JMX end-points, consider adding `spring-boot-actuator`.
|
||||
See _xref:how-to:actuator.adoc[Actuator]_ for details.
|
||||
For additional "production ready" features, such as health, auditing, and metric REST or JMX end-points, consider adding `spring-boot-actuator`.
|
||||
See xref:how-to:actuator.adoc[Actuator] for details.
|
||||
|
@ -5,6 +5,9 @@ One of the biggest advantages of packaging your application as a jar and using a
|
||||
The sample applies to debugging Spring Boot applications.
|
||||
You do not need any special IDE plugins or extensions.
|
||||
|
||||
NOTE: The options below are best suited for running an application locally for development.
|
||||
For production deployment, see xref:reference:using/packaging-for-production.adoc[Packaging for Production].
|
||||
|
||||
NOTE: This section only covers jar-based packaging.
|
||||
If you choose to package your application as a war file, see your server and IDE documentation.
|
||||
|
||||
|
@ -478,7 +478,7 @@ To get started with Jersey, include the `spring-boot-starter-jersey` as a depend
|
||||
include-code::MyJerseyConfig[]
|
||||
|
||||
WARNING: Jersey's support for scanning executable archives is rather limited.
|
||||
For example, it cannot scan for endpoints in a package found in a xref:deployment/installing.adoc[fully executable jar file] or in `WEB-INF/classes` when running an executable war file.
|
||||
For example, it cannot scan for endpoints in a package found in a xref:how-to:deployment/installing.adoc[fully executable jar file] or in `WEB-INF/classes` when running an executable war file.
|
||||
To avoid this limitation, the `packages` method should not be used, and endpoints should be registered individually by using the `register` method, as shown in the preceding example.
|
||||
|
||||
For more advanced customizations, you can also register an arbitrary number of beans that implement `ResourceConfigCustomizer`.
|
||||
|
@ -63,10 +63,18 @@
|
||||
*** xref:reference:testing/testcontainers.adoc[]
|
||||
*** xref:reference:testing/test-utilities.adoc[]
|
||||
|
||||
** xref:reference:container-images/index.adoc[]
|
||||
*** xref:reference:container-images/efficient-images.adoc[]
|
||||
*** xref:reference:container-images/dockerfiles.adoc[]
|
||||
*** xref:reference:container-images/cloud-native-buildpacks.adoc[]
|
||||
** xref:reference:packaging/index.adoc[]
|
||||
*** xref:reference:packaging/efficient.adoc[]
|
||||
*** xref:reference:packaging/class-data-sharing.adoc[]
|
||||
*** xref:reference:packaging/aot.adoc[]
|
||||
*** xref:reference:packaging/native-image/index.adoc[]
|
||||
**** xref:reference:packaging/native-image/introducing-graalvm-native-images.adoc[]
|
||||
**** xref:reference:packaging/native-image/advanced-topics.adoc[]
|
||||
*** xref:reference:packaging/checkpoint-restore.adoc[]
|
||||
*** xref:reference:packaging/container-images/index.adoc[]
|
||||
**** xref:reference:packaging/container-images/efficient-images.adoc[]
|
||||
**** xref:reference:packaging/container-images/dockerfiles.adoc[]
|
||||
**** xref:reference:packaging/container-images/cloud-native-buildpacks.adoc[]
|
||||
|
||||
** xref:reference:actuator/index.adoc[]
|
||||
*** xref:reference:actuator/enabling.adoc[]
|
||||
@ -82,14 +90,4 @@
|
||||
*** xref:reference:actuator/process-monitoring.adoc[]
|
||||
*** xref:reference:actuator/cloud-foundry.adoc[]
|
||||
|
||||
** xref:reference:deployment/index.adoc[]
|
||||
*** xref:reference:deployment/cloud.adoc[]
|
||||
*** xref:reference:deployment/installing.adoc[]
|
||||
*** xref:reference:deployment/efficient.adoc[]
|
||||
|
||||
** xref:reference:native-image/index.adoc[]
|
||||
*** xref:reference:native-image/introducing-graalvm-native-images.adoc[]
|
||||
*** xref:reference:native-image/developing-your-first-application.adoc[]
|
||||
*** xref:reference:native-image/testing-native-applications.adoc[]
|
||||
*** xref:reference:native-image/advanced-topics.adoc[]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.deployment.cloud.cloudfoundry.bindingtoservices;
|
||||
package org.springframework.boot.docs.howto.deployment.cloud.cloudfoundry.bindingtoservices;
|
||||
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.developingyourfirstapplication.sampleapplication;
|
||||
package org.springframework.boot.docs.howto.nativeimage.developingyourfirstapplication.sampleapplication;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.customhints;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.customhints;
|
||||
|
||||
class MyClass {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.customhints;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.customhints;
|
||||
|
||||
interface MyInterface {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.customhints;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.customhints;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.customhints;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.customhints;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.customhints.testing;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.customhints.testing;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.boot.docs.nativeimage.advanced.customhints.MyRuntimeHints;
|
||||
import org.springframework.boot.docs.packaging.nativeimage.advanced.customhints.MyRuntimeHints;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.nestedconfigurationproperties;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.nestedconfigurationproperties;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.nestedconfigurationproperties;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.nestedconfigurationproperties;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties;
|
||||
|
||||
public class Nested {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
|
||||
public class MyBean {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
package org.springframework.boot.docs.packaging.nativeimage.introducinggraalvmnativeimages.understandingaotprocessing.sourcecodegeneration;
|
||||
|
||||
import org.springframework.beans.factory.aot.BeanInstanceSupplier;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.deployment.cloud.cloudfoundry.bindingtoservices
|
||||
package org.springframework.boot.docs.howto.deployment.cloud.cloudfoundry.bindingtoservices
|
||||
|
||||
import org.springframework.context.EnvironmentAware
|
||||
import org.springframework.core.env.Environment
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.docs.nativeimage.advanced.nestedconfigurationproperties
|
||||
package org.springframework.boot.docs.packaging.nativeimage.advanced.nestedconfigurationproperties
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty
|
@ -155,7 +155,7 @@ def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogCo
|
||||
}
|
||||
|
||||
tasks.named("generateAntoraPlaybook") {
|
||||
xrefStubs = ["appendix:.*", "api:.*", "reference:.*"]
|
||||
xrefStubs = ["appendix:.*", "api:.*", "reference:.*", "how-to:.*"]
|
||||
alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"]
|
||||
dependsOn antoraMavenPluginLocalAggregateContent
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
Spring AOT is a process that analyzes your application at build-time and generate an optimized version of it.
|
||||
It is a mandatory step to run a Spring `ApplicationContext` in a native image.
|
||||
|
||||
NOTE: For an overview of GraalVM Native Images support in Spring Boot, check the xref:reference:native-image/index.adoc[reference documentation].
|
||||
NOTE: For an overview of GraalVM Native Images support in Spring Boot, check the xref:reference:packaging/native-image/index.adoc[reference documentation].
|
||||
|
||||
The Spring Boot Maven plugin offers goals that can be used to perform AOT processing on both application and test code.
|
||||
|
||||
@ -48,7 +48,7 @@ To benefit from the `native` profile, a module that represents an application sh
|
||||
include::example$aot-native/pom.xml[tags=aot-native]
|
||||
----
|
||||
|
||||
A single project can trigger the generation of a native image on the command-line using either xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.maven[Cloud Native Buildpacks] or xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.maven[Native Image Build Tools].
|
||||
A single project can trigger the generation of a native image on the command-line using either xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.buildpacks.maven[Cloud Native Buildpacks] or xref:how-to:native-image/developing-your-first-application.adoc#howto.native-image.developing-your-first-application.native-build-tools.maven[Native Image Build Tools].
|
||||
|
||||
To use the `native` profile with a multi-modules project, you can create a customization of the `native` profile so that it invokes your preferred technique.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user