Skip to content

cloudfoundry/java-test-applications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

385 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Name Description
dist-zip-application A Spring Boot 4.1 application, deployed as a distZip
ejb-application A Jakarta EE 10 EJB application
groovy-application A Spring Boot 4.1 application started with groovy
java-main-application A Spring Boot 4.1 application started with java -jar
java-task-application A 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-application A Spring MVC 4.1 application (Servlet 6 / WAR)

Spring Boot 3.5 (Java 17) — standalone projects

Name Description
java-main-application-boot3 A 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:

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

License

Security policy

Stars

33 stars

Watchers

20 watching

Forks

Packages

 
 
 

Contributors

Languages