See gh-33455
pull/33460/head
Johnny Lim 2 years ago committed by Moritz Halbritter
parent a4779b7859
commit 78b43279a7

@ -170,7 +170,7 @@ public class IntegrationProperties {
public static class Error {
/**
* Whether to not silently ignore messages on the global 'errorChannel' when they
* Whether to not silently ignore messages on the global 'errorChannel' when there
* are no subscribers.
*/
private boolean requireSubscribers = true;

@ -150,7 +150,7 @@ If you need the `Mockk` equivalent of the Mockito specific <<features#features.t
==== Further reading
* {kotlin-docs}[Kotlin language reference]
* https://kotlinlang.slack.com/[Kotlin Slack] (with a dedicated #spring channel)
* https://stackoverflow.com/questions/tagged/spring+kotlin[Stackoverflow with `spring` and `kotlin` tags]
* https://stackoverflow.com/questions/tagged/spring+kotlin[Stack Overflow with `spring` and `kotlin` tags]
* https://try.kotlinlang.org/[Try Kotlin in your browser]
* https://blog.jetbrains.com/kotlin/[Kotlin blog]
* https://kotlin.link/[Awesome Kotlin]

@ -23,7 +23,7 @@ For more info about Spring Batch, see the {spring-batch}[Spring Batch project pa
Spring Batch auto-configuration is enabled by adding `@EnableBatchProcessing` to one of your `@Configuration` classes.
If a single `Job` is found in the application context, it is executed on startup (see {spring-boot-autoconfigure-module-code}/batch/JobLauncherApplicationRunner.java[`JobLauncherApplicationRunner`] for details).
If multiple `Job`s are found, the job that should be executed must be specified using configprop:spring.batch.job.name[].
If multiple ``Job``s are found, the job that should be executed must be specified using configprop:spring.batch.job.name[].
To disable running a `Job` found in the application content, set the configprop:spring.batch.job.enabled[] to `false.`

@ -7,7 +7,7 @@
=== Nested Configuration Properties
Reflection hints are automatically created for configuration properties by the Spring ahead-of-time engine.
Nested configuration properties which are no inner classes, however, *must* be annotated with `@NestedConfigurationProperty`, otherwise they won't be detected and will not be bindable.
Nested configuration properties which are not inner classes, however, *must* be annotated with `@NestedConfigurationProperty`, otherwise they won't be detected and will not be bindable.
include::code:MyProperties[]
@ -35,7 +35,7 @@ NOTE: Please use public getters and setters in all cases, otherwise the properti
[[native-image.advanced.converting-executable-jars]]
=== Converting a Spring Boot Executable Jar
It is possible to convert a Spring Boot <<executable-jar#appendix.executable-jar, executable jar>> into a native image as long at the jar contains the AOT generated assets.
It is possible to convert a Spring Boot <<executable-jar#appendix.executable-jar, executable jar>> into a native image as long as the jar contains the AOT generated assets.
This can be useful for a number of reasons, including:
* You can keep your regular JVM pipeline and turn the JVM application into a native image on your CI/CD platform.
@ -97,7 +97,7 @@ Assuming an AOT processed Spring Boot executable jar built as `myproject-0.0.1-S
$ mv myproject ../
----
NOTE: These commands work on Linux or MacOS machines, you will need to adapt them for Windows.
NOTE: These commands work on Linux or macOS machines, but you will need to adapt them for Windows.
TIP: The `@META-INF/native-image/argfile` might not be packaged in your jar.
It is only included when reachability metadata overrides are needed.
@ -151,7 +151,7 @@ For further reading, please see {graal-native-image-docs}/metadata/AutomaticMeta
[[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.
Create a class that implements the `RuntimeHintsRegistrar` interface, then make appropriate calls to the provided `RuntimeHints` instance:
Create a class that implements the `RuntimeHintsRegistrar` interface, and then make appropriate calls to the provided `RuntimeHints` instance:
include::code:MyRuntimeHints[]

@ -33,20 +33,20 @@ The resulting image doesn't contain a JVM, instead the native image is compiled
This leads to smaller images.
NOTE: The builder used for the images is `paketobuildpacks/builder:tiny`.
It has small footprint and reduced surface attack, but you can also use `paketobuildpacks/builder:base` or `paketobuildpacks/builder:full` to have more tools available in the image if required.
It has small footprint and reduced attack surface, but you can also use `paketobuildpacks/builder:base` or `paketobuildpacks/builder:full` to have more tools available in the image if required.
[[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.
Docker should be installed. See https://docs.docker.com/installation/#installation[Get Docker] for more details.
https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user[Configure it to allow non-root user] if you are on Linux.
NOTE: You can run `docker run hello-world` (without `sudo`) to check the Docker daemon is reachable as expected.
Check the {spring-boot-maven-plugin-docs}/#build-image-docker-daemon[Maven] or {spring-boot-gradle-plugin-docs}/#build-image-docker-daemon[Gradle] Spring Boot plugin documentation for more details.
TIP: On MacOS, it is recommended to increase the memory allocated to Docker to at least `8GB`, and potentially add more CPUs as well.
See this https://stackoverflow.com/questions/44533319/how-to-assign-more-memory-to-docker-container/44533437#44533437[Stackoverflow answer] for more details.
TIP: On macOS, it is recommended to increase the memory allocated to Docker to at least `8GB`, and potentially add more CPUs as well.
See this https://stackoverflow.com/questions/44533319/how-to-assign-more-memory-to-docker-container/44533437#44533437[Stack Overflow answer] for more details.
On Microsoft Windows, make sure to enable the https://docs.docker.com/docker-for-windows/wsl/[Docker WSL 2 backend] for better performance.
@ -92,7 +92,7 @@ To build the image, you can run the `spring-boot:build-image` goal with the `nat
[[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.
You should check that your gradle build contains a `plugins` block that includes `org.graalvm.buildtools.native`.
You should check that your Gradle build contains a `plugins` block that includes `org.graalvm.buildtools.native`.
As long as the `org.graalvm.buildtools.native` plugin is applied, the `bootBuildImage` task will generate a native image rather than a JVM one.
You can run the task using:
@ -158,9 +158,9 @@ To build a native image using the Native Build Tools, you'll need a GraalVM dist
You can either download it manually on the {liberica-nik-download}[Liberica Native Image Kit page], or you can use a download manager like SDKMAN!.
[[native-image.developing-your-first-application.native-build-tools.prerequisites.linux-macos]]
===== Linux and MacOS
===== Linux and macOS
To install the native image compiler on MacOS or Linux, we recommend using SDKMAN!.
To install the native image compiler on macOS or Linux, we recommend using SDKMAN!.
Get SDKMAN! from https://sdkman.io and install the Liberica GraalVM distribution by using the following commands:
[source,shell,indent=0,subs="verbatim,attributes"]
@ -221,7 +221,7 @@ The native image executable can be found in the `build/native/nativeCompile` dir
[[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:
At this point, your application should worK. You can now start the application by running it directly:
[source,shell,indent=0,subs="verbatim",role="primary"]
.Maven

@ -27,7 +27,7 @@ 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.
TIP: The {graal-native-image-docs}/metadata/Compatibility/[Native Image Compatibility Guide] section of the GraalVM reference documentation provide more details about GraalVM limitations.
TIP: The {graal-native-image-docs}/metadata/Compatibility/[Native Image Compatibility Guide] section of the GraalVM reference documentation provides more details about GraalVM limitations.
@ -126,7 +126,7 @@ TIP: Generated hint files can be found in `target/spring-aot/main/resources` whe
Spring sometimes needs to generate proxy classes to enhance the code you've written with additional features.
To do this, it uses the cglib library which directly generates bytecode.
When an application is running on the JDK, proxy classes are generated dynamically as the application runs.
When an application is running on the JVM, proxy classes are generated dynamically as the application runs.
When creating a native image, these proxies need to be created at build-time so that they can be included by GraalVM.
NOTE: Unlike source code generation, generated bytecode isn't particularly helpful when debugging an application.

@ -6,7 +6,7 @@ With broad test coverage on the JVM, you can then focus native image testing on
For native image testing, you're generally looking to ensure that the following aspects work:
* The Spring AOT engine is able to process your application and will it run in an AOT-processed mode.
* The Spring AOT engine is able to process your application, and it will run in an AOT-processed mode.
* GraalVM has enough hints to ensure that a valid native image can be produced.
@ -39,7 +39,7 @@ If your application starts with the `spring.aot.enabled` property set to `true`,
You can also consider running integration tests against the running application.
For example, you could use the Spring `WebClient` to call your application REST endpoints.
Or you might consider using a project like Selenium to check your applications HTML responses.
Or you might consider using a project like Selenium to check your application's HTML responses.
@ -59,7 +59,7 @@ You can also use Spring Boot <<features#features.testing.spring-boot-application
Spring Framework's native testing support works in the following way:
* Test are analyzed in order to discover any `ApplicationContext` instances that will be required.
* Tests are analyzed in order to discover any `ApplicationContext` instances that will be required.
* Ahead-of-time processing is applied to each of these application contexts and assets are generated.
* A native image is created, with the generated assets being processed by GraalVM.
* The native image also includes the JUnit `TestEngine` configured with a list of the discovered tests.
@ -98,7 +98,7 @@ To build the image and run the tests, use the `test` goal with the `nativeTest`
[[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.
You should check that your gradle build contains a `plugins` block that includes `org.graalvm.buildtools.native`.
You should check that your Gradle build contains a `plugins` block that includes `org.graalvm.buildtools.native`.
To run native tests using Gradle you can use the `nativeTest` task:

Loading…
Cancel
Save