github.com/paketo-buildpacks/spring-boot/v5@v5.29.2-0.20240515125826-896d9a009549/README.md (about) 1 # `gcr.io/paketo-buildpacks/spring-boot` 2 The Paketo Buildpack for Spring Boot is a Cloud Native Buildpack that contributes Spring Boot dependency information and slices an application into multiple layers. 3 4 ## Behavior 5 6 This buildpack will always detect. 7 8 This buildpack will participate at build time if all the following conditions are met: 9 10 * `<APPLICATION_ROOT>/META-INF/MANIFEST.MF` contains a `Spring-Boot-Version` entry 11 12 The buildpack will do the following: 13 14 * Contributes Spring Boot version to `org.springframework.boot.version` image label 15 * If `<APPLICATION_ROOT>/META-INF/dataflow-configuration-metadata.properties` exists 16 * Contributes Spring Boot configuration metadata to `org.springframework.boot.spring-configuration-metadata.json` image label 17 * Contributes Spring Cloud Data Flow configuration metadata to `org.springframework.cloud.dataflow.spring-configuration-metadata.json` image label 18 * Contributes `Implementation-Title` manifest entry to `org.opencontainers.image.title` image label 19 * Contributes `Implementation-version` manifest entry to `org.opencontainers.image.version` image label 20 * Contributes dependency information extracted from Maven naming conventions to the image's BOM 21 * When contributing to a JVM application: 22 * Contributes [Spring Cloud Bindings][b] as an application dependency 23 * This enables bindings-aware Spring Boot auto-configuration when [CNB bindings][c] are present during launch 24 * The version of the Spring Cloud Bindings library to install will be determined by (in order): 25 * An explicit value set in `BP_SPRING_CLOUD_BINDINGS_VERSION` by the user 26 * The Spring Boot version from `<APPLICATION_ROOT>/META-INF/MANIFEST.MF`: Boot 2.x will install Spring Cloud Bindings v1, Boot 3.x will install Spring Cloud Bindings v2 27 * If `<APPLICATION_ROOT>/META-INF/MANIFEST.MF` contains a `Spring-Boot-Layers-Index` entry 28 * Contributes application slices as defined by the layer's index 29 * If the application is a reactive web application 30 * Configures `$BPL_JVM_THREAD_COUNT` to 50 31 * If the application is AOT instrumented (presence of `META-INF/native-image` folder) AND `BP_SPRING_AOT_ENABLED` is set to `true` 32 * set `BPL_SPRING_AOT_ENABLED` to true 33 * add `-Dspring.aot.enabled=true` to `JAVA_TOOL_OPTIONS` at runtime 34 * If `<APPLICATION_ROOT>/META-INF/MANIFEST.MF` contains a `Spring-Boot-Native-Processed` entry OR if `$BP_MAVEN_ACTIVE_PROFILES` contains the `native` profile: 35 * A build plan entry is provided, `native-image-application`, which can be required by the `native-image` [buildpack](https://github.com/paketo-buildpacks/native-image) to automatically trigger a native image build 36 * When contributing to a native image application: 37 * Adds classes from the executable JAR and entries from `classpath.idx` to the build-time class path, so they are available to `native-image` 38 39 [b]: https://github.com/spring-cloud/spring-cloud-bindings 40 [c]: https://github.com/buildpacks/spec/blob/main/extensions/bindings.md 41 42 ## Configuration 43 | Environment Variable | Description | 44 |---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 45 | `$BP_SPRING_CLOUD_BINDINGS_DISABLED` | Whether to contribute Spring Cloud Bindings support to the image at build time. Defaults to false. | 46 | `$BPL_SPRING_CLOUD_BINDINGS_DISABLED` | Whether to auto-configure Spring Boot environment properties from bindings at runtime. This requires Spring Cloud Bindings to have been installed at build time or it will do nothing. Defaults to false. | 47 | `$BPL_SPRING_CLOUD_BINDINGS_ENABLED` | Deprecated in favour of `$BPL_SPRING_CLOUD_BINDINGS_DISABLED`. Whether to auto-configure Spring Boot environment properties from bindings at runtime. This requires Spring Cloud Bindings to have been installed at build time or it will do nothing. Defaults to true. | 48 | `$BP_SPRING_CLOUD_BINDINGS_VERSION` | Explicit version of Spring Cloud Bindings library to install. | 49 | `$BP_SPRING_AOT_ENABLED` | Whether to contribute `$BPL_SPRING_AOT_ENABLED` at runtime. Beware that the Spring Boot app needs to have been AOT instrumented (presence of `META-INF/native-image`) too. Defaults to false. | 50 | `$BPL_SPRING_AOT_ENABLED` | Whether to contribute `-Dspring.aot.enabled=true` to `JAVA_TOOL_OPTIONS` at runtime. Defaults to yes if the above conditions were met; false otherwise | 51 | `$BP_JVM_CDS_ENABLED` | Whether to perform the CDS training run (that will generate the caching file `application.jsa`). Defaults to false. | 52 | `$CDS_TRAINING_JAVA_TOOL_OPTIONS` | Allow the user to override the default `JAVA_TOOL_OPTIONS`, only for the CDS training run. Useful to configure your app not to reach external services during training run for example. | 53 | `$BPL_JVM_CDS_ENABLED` | Whether to load the CDS caching file (`-XX:SharedArchiveFile=application.jsa`) that was generated during the CDS training run. Defaults to the value of `BP_JVM_CDS_ENABLED` | 54 ## Bindings 55 The buildpack optionally accepts the following bindings: 56 57 ### Type: `dependency-mapping` 58 | Key | Value | Description | 59 | --------------------- | ------- | ------------------------------------------------------------------------------------------------- | 60 | `<dependency-digest>` | `<uri>` | If needed, the buildpack will fetch the dependency with digest `<dependency-digest>` from `<uri>` | 61 62 ## License 63 This buildpack is released under version 2.0 of the [Apache License][a]. 64 65 [a]: http://www.apache.org/licenses/LICENSE-2.0 66