Spring Boot

Hosting Spring Boot Standalone and Clustered Java Applications

Spring Boot applications can be deployed as standalone Java services or scaled into clustered environments. The platform supports executable JAR, WAR and ZIP-based deployments, multiple build and CI/CD workflows, container-level configuration, automatic scaling, SSL and custom-port exposure.

Create a Spring Boot Environment

Open the environment topology wizard, switch to the Java language tab and select the Spring Boot application-server template. Set the required resource limits, enter the environment name and create the environment.

Spring Boot environment creation
Select the Spring Boot stack and configure resources in the environment wizard.

After the environment appears in the dashboard, use Open in Browser to launch the pre-installed sample and verify that the Spring Boot server is running.

Open Spring Boot environment in browser
Open the Spring Boot environment from the dashboard.
Spring Boot default site
The default application confirms that the Spring Boot instance is ready.

Deploy Java Applications to Spring Boot

Applications should be packaged as executable archives containing the compiled classes, dependencies and resources required to run the project.

JAR

Suitable for standalone Java applications and stateless microservices. The JAR should define its entry point in the manifest or be packaged as a fat or nested executable JAR.

WAR

Suitable for web applications with an embedded servlet container and can be useful for JSP-based Spring Boot projects.

For manual deployment, upload the application archive through Deployment Manager, click Deploy to, select the Spring Boot environment and confirm the deployment.

Deploy Spring Boot application
Upload the archive through Deployment Manager and deploy it to the Spring Boot environment.

ZIP Bundle Deployment

A ZIP bundle can contain an executable JAR together with external configuration files, logging configuration, libraries and other directories. This is useful when production settings should remain outside the packaged JAR.

application.zip
 |
 +-config
 |   +-application.properties
 |   +-log4j.properties
 +-lib
 |   +-my-springboot-app.jar
 +-some_directory
 |   +-additional_file1
 |   +-additional_file2
 +-additional_configuration.yml

When the ZIP archive is unpacked, the platform searches its directories for a runnable JAR. A JAR containing a Main-Class entry in META-INF/MANIFEST.MF can be used as the execution point.

Remote Deployment through CLI

Applications can also be deployed remotely using the platform CLI.

~/jelastic/environment/control/deployapp \
--envName spring-boot-app \
--fileUrl http://link/to/archive \
--fileName my_springboot.jar \
--context ROOT

Check Application Logs

After deployment, allow the application enough time to initialize. The startup process can be monitored through the Spring Boot server run.log.

Spring Boot application logs
Track application initialization and runtime operations through the server logs.

If the application listens on the standard port 8080, it can be opened through the environment URL after startup completes.

Build Spring Boot Applications

Executable Spring Boot archives can be produced with Gradle or Maven.

Gradle

./gradlew clean assemble

The generated JAR is normally placed in the project’s build/libs directory.

Maven

mvn clean package

The generated application archive is normally stored in the target directory.

CI/CD Options for Java Applications

Maven PluginIntegrate the platform Maven plugin into the project to build and push the application to the target environment in one workflow.
Maven Build NodeUse a dedicated Maven node in the cloud to fetch, compile and deploy projects from remote Git or SVN repositories.
Git-Push-DeployAutomate rebuild and delivery after changes are pushed to supported Git repositories.

Maintain the Spring Boot Server

Most common maintenance operations can be performed directly from the dashboard.

  • Use Configuration Manager to create, upload, edit or remove files.
  • Configure mount points and exported data.
  • Set custom JVM options through JAVA_OPTS and JAVA_ARGS.
  • Review server logs.
  • Monitor resource statistics.
  • Use Web SSH or a local SSH client for advanced administration.
Spring Boot file manager
Manage Spring Boot files and configuration through the built-in Configuration Manager.
Spring Boot environment variables
Configure JVM and application options through environment variables.
Application Files/home/jelastic/APP
JVM Configuration/home/jelastic/conf/variables.conf
Logs/var/log
Home Directory/home/jelastic
JDK/usr/java/latest

To restart the application from SSH, use:

jem service restart

Automatic Scaling for Spring Boot

Automatic Vertical Scaling

Vertical scaling adjusts the resources available to the Spring Boot server within the configured limits. The maximum Java heap size can be adjusted according to the allocated memory.

  • 8 cloudlets (1 GiB RAM) can provide a maximum heap of approximately 819 MB.
  • 16 cloudlets (2 GiB RAM) can provide a maximum heap of approximately 1638 MB.

Custom JVM memory settings can be defined in /home/jelastic/conf/variables.conf.

Automatic Horizontal Scaling

Horizontal scaling changes the number of application-server instances according to monitoring triggers based on resource usage.

  • CPU
  • Memory (RAM)
  • Network
  • Disk I/O
  • Disk IOPS
Spring Boot automatic horizontal scaling
Configure monitoring triggers to scale the number of Spring Boot application servers automatically.

Automatic load balancing

When the application layer is scaled out, an NGINX load balancer can be added automatically and configured for sticky-session load balancing. Other supported balancer stacks can be selected when required.

Newly added nodes are distributed across different hardware servers where possible to improve application availability.

Traffic Encryption with SSL

Spring Boot environments can use platform-level SSL so encrypted traffic is terminated at the load-balancing layer rather than configured inside the application itself.

Built-in SSLUses the platform wildcard SSL certificate for the internal environment domain.
Custom SSLAllows a custom certificate to be configured for environments with a supported load balancer.
Let’s EncryptCan provide automated certificates for internal and custom domains where the add-on is available.
Spring Boot SSL configuration
Use platform-level SSL options to encrypt traffic for Spring Boot applications.

Custom Ports and HTTP/HTTPS

Spring Boot applications commonly listen on port 8080 for HTTP traffic. Standard application ports are mapped to the public HTTP and HTTPS endpoints automatically.

HTTPInternal application port 8080 is mapped to public port 80.
HTTPSSecure application traffic can be exposed through the standard HTTPS endpoint.
Custom PortsExpose private TCP or UDP ports through platform endpoints when the application needs a non-standard interface.

When an endpoint is created, the corresponding firewall rule is enabled so the selected port can be reached externally.

Expected Result

The Spring Boot application runs in a managed cloud environment that supports multiple deployment formats, CI/CD automation, file and JVM configuration, monitoring, automatic vertical and horizontal scaling, load balancing, SSL and custom-port access.