Heroku Cloud+Spring Boot - How to deploy the Spring Boot application on the Heroku cloud?

Hello everyone, today we will learn how to deploy a demo spring boot application on the Heroku cloud.

Let me first tell you what the Heroku cloud is!

Heroku cloud is a platform as service(PaaS) that enables developers to build, run, and operate applications entirely on the cloud. Heroku is best suitable for startups, Medium business. Heroku supports 175+ add-ons that cover various purposes – from notifications to security. In general, this cloud tech service is more user-friendly compared to EC2. Heroku helps to increase the productivity of your team by creating an environment for rolling-out and development processes.

What is Add-ons?

Add-ons are cloud services that extend Heroku apps with useful features and services, such as 

  • Datastores 
  • Logging 
  • Monitoring 
  • Content management
There are two  things to take into account:

Type of business
If you own a small business, the best option will be a Platform as a Service solution. Just choose the settings, and don’t bother with things your project doesn’t require yet.

Deployment speed
Heroku provides a ready-to-use environment where you only need to enter the code, make a few changes, and that’s it – you start running the app. Plus, you can migrate and run apps much faster compared to AWS. So if you need to make changes and fixes based on customers’ reviews – and do it fast – Heroku will be your perfect choice.

Consider Heroku if: 
  • You want to build an MVP(minimum viable product) app, deploy, and test it 
  • You will continuously improve your app based on customers’ reviews 
  • You don’t have DevOps engineers in the team 
  • The project doesn’t require huge computing power
Now I am going to tell you how to deploy a spring boot application on the Heroku cloud.


If you have already an account on GitHub login to "https://github.com/."


If you not yet registered please sign up, Join


Create a new Github repository. Click the new repository button in the top-right. You'll have an option there to initialize the repository.


Give a unique name to your new repository.

Here, the name of our new repository is springboot_heroku_demo. We can choose the visibility public or private. 

For our learning purpose, I created a simple restful API using spring-boot.
You can download the demo source code from the knowledgefactory Github account and upload that source code to your new Github repository.
Download  sample code:

Commit the changes.

Sign In to Heroku cloud console:
If you not yet registered please sign up.

After sign in to the Heroku console, you can view the below screen.
Click the "create new app" button.


Enter your new application name and server region

Here, I entered the "spring-boot-Heroku-demo-dev" as the application name and server location United States. Then click the "Create app" button


Choose one deployment method.

Here I selected GitHub because our repository is Github.

Connect your Heroku app to your Github repository.

Here, I selected our repository as springboot_heroku_demo because we are going to deploy the same on the Heroku cloud.

Step11( Optional)

Automatic deploys: enables the selected branch to be automatically deployed on this app.


Manual Deploy: Deploy the current state of a branch to this app.

Confirm deployment, build logs are available there for your reference.
Test your API using postman.

More related topics,

Java - Angular - VueJS - ReactJS

NodeJS - Angular - VueJS - ReactJS

Python - Flask  - Angular - VueJS - ReactJS

Popular posts from this blog

Spring boot video streaming example-HTML5

Learn Java 8 streams with an example - print odd/even numbers from Array and List

Spring Boot + Mockito simple application with 100% code coverage

Spring Boot + OpenCSV Export Data to CSV Example

Custom Exception Handling in Quarkus REST API

DataTable-Pagination example with Spring boot, jQuery and ajax

Registration and Login with Spring Boot + Spring Security + Thymeleaf

Node JS mini projects with source code - free download

Spring boot web project free download:User Registration System

Java - Blowfish Encryption and decryption Example