Skip to content

Repository files navigation

Java Test Applications

A collection of applications used for testing the Java buildpack.

Applications

Spring Boot 4.1 (Java 21) — multi-module build

NameDescription
dist-zip-applicationA Spring Boot 4.1 application, deployed as a distZip
ejb-applicationA Jakarta EE 10 EJB application
groovy-applicationA Spring Boot 4.1 application started with groovy
java-main-applicationA Spring Boot 4.1 application started with java -jar
java-task-applicationA Spring Boot 4.1 CF task application. Tests Spring Boot Start-Class detection and JBP_CONFIG_JAVA_MAIN class override. Push with instances: 0, run via cf run-task
web-applicationA Spring MVC 4.1 application (Servlet 6 / WAR)

Spring Boot 3.5 (Java 17) — standalone projects

NameDescription
java-main-application-boot3A Spring Boot 3.5 application started with java -jar

Standalone projects have their own build.gradle and Gradle wrapper and are not included in the root multi-module build. Build them from their own directory.

Output Content

⚠️These applications are for CI/integration testing only. Endpoints such as /spring-env, /environment-variables, and /system-properties can expose sensitive runtime values (credentials, service bindings, system properties). Never deploy to production or shared environments.

All applications support the following REST operations:

URIDescription
GET /The health of the application
GET /active-profilesThe active Spring profiles (e.g. ["cloud"] when java-cfenv is active)
GET /class-pathThe JVM system classpath (boot loader only — see /loaded-jars for full picture)
GET /environment-variablesThe environment variables available to the application
GET /input-argumentsThe list of JVM input arguments for the application
GET /loaded-jarsAll jars loaded by the full classloader chain including BOOT-INF/lib/
POST /out-of-memoryThe URL to trigger an out of memory error
GET /request-headersThe http request headers of the current request
GET /security-providersThe system security providers available to the application
GET /spring-env?key=<property>A single Spring Environment property value (404 if absent)
GET /system-propertiesThe system properties available to the application

java-main-application-boot3 exposes only GET / (health).

Building

Prerequisites

  • JDK 21 for the multi-module build (Spring Boot 4.1 modules)
  • JDK 17 for standalone Spring Boot 3.5 projects

Both JDKs can be managed with sdkman:

sdk install java 21.0.10-librca
sdk install java 17.0.19-tem

Note: This applies to the root multi-module build (Gradle 9.6.1 / ASM 9.9, supports Java 21–26). java-main-application-boot3 is a standalone project with its own Gradle wrapper — check its wrapper version separately. Java 27+ requires a newer Gradle release. Java 21 is recommended — it matches the project toolchain. To pin the daemon, add org.gradle.java.home=/path/to/java21 in a local (uncommitted) gradle.properties.

Multi-module build (Spring Boot 4.1)

./gradlew

Standalone projects (Spring Boot 3.5)

cd java-main-application-boot3
./gradlew bootJar

Building Behind a Proxy

Since this project downloads its dependencies from the internet, building behind a proxy requires some extra effort. Configure Gradle with the following system properties (more information here):

./gradlew -Dhttp.proxyHost=<HOST> -Dhttp.proxyPort=<PORT>

Deploying to Cloud Foundry

Each test application contains a manifest.yml file which allows the built application to be deployed to Cloud Foundry by simply issuing:

cf push

To avoid clashing with the URLs of other applications, you should specify your own subdomain for the application (unless the test application does not need a subdomain).

Failure Testing

Failure testing is supported for each of the above applications by setting a suitable environment variable.

If the environment variable FAIL_INIT is set, the application will fail to initialize:

cf set-env <application name> FAIL_INIT true

If the environment variable FAIL_OOM is set, the application will repeatedly exhaust the heap until the JVM is killed:

cf set-env <application name> FAIL_OOM true

Running Tests

To run the tests, do the following:

./gradlew

License

The project is released under version 2.0 of the Apache License.

About

Applications used for testing the Java buildpack

Resources

Security policy

Stars

33 stars

Watchers

20 watching

Forks

Releases

Packages

Used by

Contributors

Languages