Articles on: Websites & APIs

How to host Spring applications

How to Host Spring Applications on Square Cloud


Spring Boot has made life easier for Java developers by embedding the server (such as Tomcat) directly into the executable file. To run your application on Square Cloud, the focus must be on network configuration and generating the correct artifact.



1. Configuring the Port (Port 80)


Unlike the local environment where we usually use port 8080, Square Cloud requires your application to listen on port 80.


You can configure this in two ways:


Via Properties File:

In your src/main/resources/application.properties file:

server.port=80


Or, if you prefer YAML (application.yml):

server:
port: 80


You can also leave the default port in the code and define an ENV variable in the Square Cloud dashboard:

  • Name: SERVER_PORT
  • Value: 80



2. Packaging the Application (JAR)


Square Cloud executes Java applications through JAR (Java Archive) files. You must generate an "Uber JAR" (or Fat JAR), which contains all the necessary dependencies inside a single file.


Using Maven:

Run the command at the root of the project:

./mvnw clean package


Using Gradle:

Run the command at the root of the project:

./gradlew build


The generated file will be in the target/ folder (Maven) or build/libs/ folder (Gradle).



3. Preparing the Deployment


For submission, we recommend creating a .zip file containing:

  1. Your .jar file (e.g., my-api-1.0.0.jar).
  2. External configuration files (if any).


Note: It is not necessary to send the source code (src/), only the compiled artifact.



4. Monitoring Tips


  • Logs: Spring Boot generates detailed logs. Follow them in the Square terminal to identify dependency injection errors or database connection failures.
  • Health Checks: If you are using Spring Boot Actuator, you can monitor your application's health in real time.

Updated on: 05/26/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!