{"id":15805243,"url":"https://github.com/ddobrin/spring-function-multi-platform","last_synced_at":"2025-10-15T06:03:38.197Z","repository":{"id":134175906,"uuid":"336323469","full_name":"ddobrin/spring-function-multi-platform","owner":"ddobrin","description":"A simple Spring Function sample, deployable across multiple platforms","archived":false,"fork":false,"pushed_at":"2021-02-06T19:55:24.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-06T02:05:46.350Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddobrin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-05T16:17:47.000Z","updated_at":"2021-02-06T19:55:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"4662f94a-04a7-4466-a302-6a6f9695cee6","html_url":"https://github.com/ddobrin/spring-function-multi-platform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddobrin%2Fspring-function-multi-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddobrin%2Fspring-function-multi-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddobrin%2Fspring-function-multi-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddobrin%2Fspring-function-multi-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddobrin","download_url":"https://codeload.github.com/ddobrin/spring-function-multi-platform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246547369,"owners_count":20794970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T02:05:20.768Z","updated_at":"2025-10-15T06:03:33.159Z","avatar_url":"https://github.com/ddobrin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"This sample app provides a simple `Hello` web app based on Spring Boot and Spring Cloud Function.\n\nWhich topics are addressed in this repo:\n* Build\n  *  Build a JVM or Native image with Spring Boot and GraalVM\n  *  Run locally\n\nBuild Options:\n* JVM application, leveraging OpenJDK\n* Native Application, leveraging GraalVM\n\nSupported Versions:\n* Spring Boot 2.4.1\n* Spring Native 0.8.5\n* OpenJDK version \"11.0.10\" 2021-01-19\n* OpenJDK 64-Bit Server VM GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)\n\nDeployment Models:\n* Standalone web app\n* Kubernetes Deployment and Service\n* Knative Service\n\nSource code tree:\n```\nsrc/\n├── main\n│   ├── java\n│   │   └── com\n│   │       └── example\n│   │           └── hello\n│   │               └── HelloFunction.java\n│   └── resources\n│       ├── application.properties\n│       ├── static\n│       └── templates\n└── test\n    └── java\n        └── com\n            └── example\n                └── hello\n                    └── HelloFunctionTests.java\n\n# The function used in this app is available in HelloFunction.java\n```\n\n# Build\n\nBuilding the code with the Spring Boot Maven wrapper leverages the following profiles:\n* native-image - build a Spring Native image leveraging GraalVM\n* jvm-image - build a Spring JVM-based image leveraging OpenJDK\n\nBuilding an executable application with the GraalVM compiler leverages the profile and requires the installation of the GraalVM and the native-image builder utility:\n* native\n\n## Build code as a JVM app - uses Spring Boot Maven plugin, embedded Netty HTTP server\n```bash \n# build and run code using\n$ ./mvnw clean spring-boot:run\n\n# run with default app properties\n./mvnw clean package spring-boot:run\n\n# test locally\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: from-function\n\n# test with env vars\n./mvnw clean package spring-boot:run -Dspring-boot.run.arguments=--TARGET=localtest\n\n# test locally\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: localtest\n```\n\n## Build code as a Native app - uses the GraalVM compiler, embedded Netty HTTP server\n```bash \n# switch to the GraalVM JDK for this build\n# ex, when using SDKman\n$ sdk use java 21.0.0.r11-grl\n\n# build and run code using\n$ ./mvnw clean package -Pnative\n\n# start the native executable\n$ ./target/hello-function\n\n# test locally\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: from-function\n```\n\n## Build code as a JVM image using the Spring Boot Maven plugin\n```bash \n# build image with \u003cdefault\u003e configuration\n$ ./mvnw clean spring-boot:build-image\n\n# test with Docker\ndocker run -p 8080:8080 hello-function:0.0.1\n\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: from-function\n\n# test with Docker and env vars\ndocker run -e TARGET=dockertest -p 8080:8080 hello-function:0.0.1\n\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: dockertest\n\n#--------------------------------------------------------------\n# build JVM image with the CNB Paketo buildpack of your choice\n$ ./mvnw clean spring-boot:build-image -Pjvm-image\n\n# start Docker image\n$ docker run -e TARGET=docker-jvm-image-test -p 8080:8080 hello-function:jvm\n\n# test Docker image locally\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: docker-jvm-image-test\n```\n\n## Build code as a Spring Native image using the Spring Boot Maven plugin and the Java Native Paketo Buildpacks\n```bash \n# build image with the CNB Paketo buildpack of your choice\n$ ./mvnw clean spring-boot:build-image -Pnative-image\n\n# start Docker image\n$ docker run -e TARGET=docker-native-image-test -p 8080:8080 hello-function:native\n\n# test Docker image locally\n$ curl -w'\\n' -H 'Content-Type: text/plain' localhost:8080 -d \"from a Function\"\nHello: from a Function, Source: docker-native-image-test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddobrin%2Fspring-function-multi-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddobrin%2Fspring-function-multi-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddobrin%2Fspring-function-multi-platform/lists"}