Update Spring Boot to 2.7.7 (#1502)

* Update Spring Boot to 2.7.7

- also add function-template springboot.md doc

Signed-off-by: Thomas Risberg <trisberg@pivotal.io>

* Fix lint errors

Signed-off-by: Thomas Risberg <trisberg@pivotal.io>
This commit is contained in:
Thomas Risberg 2023-01-18 14:30:03 -05:00 committed by GitHub
parent 1dec136e74
commit 63aab77884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6733 additions and 6607 deletions

View File

@ -0,0 +1,88 @@
# Spring Boot Function Developer's Guide
When creating a Spring Boot function using the `func` CLI, the project
directory looks like a typical Boot project.
To create a HTTP function that echos the input run the following command:
```
func create -l springboot fn
```
This is the HTTP function template structure:
```
Project path: /home/developer/projects/fn
Function name: fn
Language Runtime: springboot
Template: http
tree
fn
├── func.yaml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── README.md
└── src
├── main
│   ├── java
│   │   └── functions
│   │   └── CloudFunctionApplication.java
│   └── resources
│   └── application.properties
└── test
└── java
└── functions
└── EchoCaseFunctionTest.java
```
This is a full-featured, self-contained Spring Boot application that uses [Spring Cloud Function](https://spring.io/projects/spring-cloud-function) and [Spring WebFlux](https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html) web framework to listen for HTTP requests on port 8080.
See the generated [README.md](../../templates/springboot/http/README.md) for
details on building, testing, and deploying the HTTP app.
You may have noticed the `func.yaml` file. This is a configuration
file used by `func` to deploy your project as a service in your
kubernetes cluster.
For an event-triggered function, pass the `-t cloudevents` option to
generate an app capable of responding to
[CloudEvents](https://cloudevents.io):
```
func create -l springboot -t cloudevents fn
```
A CloudEvent function have a similar template structure to the above HTTP function:
```
Project path: /home/developer/projects/fn
Function name: fn
Language Runtime: springboot
Template: cloudevents
tree
fn
├── func.yaml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── README.md
└── src
├── main
│   ├── java
│   │   └── echo
│   │   ├── EchoFunction.java
│   │   └── SpringCloudEventsApplication.java
│   └── resources
│   └── application.properties
└── test
└── java
└── echo
└── SpringCloudEventsApplicationTests.java
```
The handlers of each app differ slightly. See its generated
[README.md](../../templates/springboot/cloudevents/README.md) for more details.
Have fun!

View File

@ -60,6 +60,17 @@ This command will build and deploy the function into cluster.
func deploy -v # also triggers build
```
### For ARM processor based systems
Building Spring Boot apps with Paketo Buildpacks on an ARM processor based system, like an Apple Macbook with an M1 or M2 chip, doesn't work well at the moment.
To work around this you can build the image on your local system using [Jib](https://github.com/GoogleContainerTools/jib).
Then, you would deploy the Jib generated image.
```
./mvnw compile com.google.cloud.tools:jib-maven-plugin:3.3.1:dockerBuild -Dimage=$FUNC_REGISTRY/echo
func deploy --build=false --image=$FUNC_REGISTRY/echo
```
## Function invocation
Spring Cloud Functions allows you to route CloudEvents to specific functions using the `Ce-Type` attribute.

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<version>2.7.7</version>
<relativePath/>
</parent>
@ -18,9 +18,9 @@
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.3</spring-cloud.version>
<spring-native.version>0.12.1</spring-native.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
<spring-native.version>0.12.2</spring-native.version>
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
@ -128,7 +128,7 @@
<id>native</id>
<properties>
<repackage.classifier>exec</repackage.classifier>
<native-buildtools.version>0.9.11</native-buildtools.version>
<native-buildtools.version>0.9.12</native-buildtools.version>
</properties>
<dependencies>
<dependency>

View File

@ -60,6 +60,17 @@ This command will build and deploy the function into cluster.
func deploy -v # also triggers build
```
### For ARM processor based systems
Building Spring Boot apps with Paketo Buildpacks on an ARM processor based system, like an Apple Macbook with an M1 or M2 chip, doesn't work well at the moment.
To work around this you can build the image on your local system using [Jib](https://github.com/GoogleContainerTools/jib).
Then, you would deploy the Jib generated image.
```
./mvnw compile com.google.cloud.tools:jib-maven-plugin:3.3.1:dockerBuild -Dimage=$FUNC_REGISTRY/echo
func deploy --build=false --image=$FUNC_REGISTRY/echo
```
## Function invocation
For the examples below, please be sure to set the `URL` variable to the route of your function.

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<version>2.7.7</version>
<relativePath/>
</parent>
@ -18,9 +18,9 @@
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.3</spring-cloud.version>
<spring-native.version>0.12.1</spring-native.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
<spring-native.version>0.12.2</spring-native.version>
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
@ -128,7 +128,7 @@
<id>native</id>
<properties>
<repackage.classifier>exec</repackage.classifier>
<native-buildtools.version>0.9.11</native-buildtools.version>
<native-buildtools.version>0.9.12</native-buildtools.version>
</properties>
<dependencies>
<dependency>

13210
zz_filesystem_generated.go generated

File diff suppressed because it is too large Load Diff