https://github.com/la3rence/spring-native-demo
AOT compiling spring boot native image.
https://github.com/la3rence/spring-native-demo
cloud-native spring-boot
Last synced: 2 months ago
JSON representation
AOT compiling spring boot native image.
- Host: GitHub
- URL: https://github.com/la3rence/spring-native-demo
- Owner: la3rence
- Created: 2021-09-23T15:11:19.000Z (almost 5 years ago)
- Default Branch: java11
- Last Pushed: 2021-10-24T09:02:19.000Z (over 4 years ago)
- Last Synced: 2025-03-06T02:49:43.840Z (over 1 year ago)
- Topics: cloud-native, spring-boot
- Language: Java
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.4/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.4/maven-plugin/reference/html/#build-image)
* [Spring Native Reference Guide](https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.5.4/reference/htmlsingle/#boot-features-developing-web-applications)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
### Additional Links
These additional references should also help you:
* [Configure the Spring AOT Plugin](https://docs.spring.io/spring-native/docs/0.10.3/reference/htmlsingle/#spring-aot-maven)
## Spring Native
This project has been configured to let you generate either a lightweight container or a native executable.
### Lightweight Container with Cloud Native Buildpacks
If you're already familiar with Spring Boot container images support, this is the easiest way to get started with Spring
Native. Docker should be installed and configured on your machine prior to creating the image,
see [the Getting Started section of the reference guide](https://docs.spring.io/spring-native/docs/0.10.3/reference/htmlsingle/#getting-started-buildpacks)
.
To create the image, run the following goal:
```
$ ./mvnw spring-boot:build-image
```
Then, you can run the app like any other container:
```
$ docker run --rm -p 8080:8080 spring-native-demo:0.0.1-SNAPSHOT
```
### Executable with Native Build Tools
Use this option if you want to explore more options such as running your tests in a native image. The GraalVM
native-image compiler should be installed and configured on your machine,
see [the Getting Started section of the reference guide](https://docs.spring.io/spring-native/docs/0.10.3/reference/htmlsingle/#getting-started-native-build-tools)
.
To create the executable, run the following goal:
```
$ ./mvnw package -Pnative
```
Then, you can run the app as follows:
```
$ target/spring-native-demo
```