Deploy Spring Boot Application to Railway.App Service

Hey, guys welcome back to yet another interesting post. In this post, we will discuss deploying the Spring Boot application to the production server using service.

If you are following my youtube channel, then you probably know that previously I was deploying my Spring Boot application to Heroku and AWS, but after Heroku changed its pricing plan, I was looking for a platform to Host my Spring boot applications. I recently came across this service, you can deploy your Spring Boot application in just a few minutes. You don’t have to provide any credit/debit card details to create an account. Once you create the Account, you will be under the Standard plan, where you will get 500Hrs execution time each month, after 500Hrs your application will shut down automatically and restart next month. This is more than enough for your hobby projects.

Read More:

Watch the Video

Create Spring Boot Project

There are many different ways to create a spring boot application, you can follow the below articles to create one –

>> Create spring boot application using Spring initializer
>> Create spring boot application in Spring tool suite [STS]
>> Create spring boot application in IntelliJ IDEA

Add maven dependencies

Open pom.xml and add the following dependencies –

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
		<relativePath/> <!-- lookup parent from repository -->
	<description>Spring boot image upload and download project</description>



Create a Controller

Create a class under the default package and add the following content

package in.bushansirgur.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

public class HomeController {
	@GetMapping({"/", "/home", "/status"})
	public String getStatus() {
		return "Application is up and running";

Run the app

Run the application using the below maven command –

mvn spring-boot:run

Create Github Repository

Login to your GitHub account, create a new repository


Once you create the repository, it will show you the instructions to push your code to Github.


Push the source code to GitHub

Open the terminal, go to the root of the project and execute the following commands

Note: Make sure that you installed git on your system before executing these commands

git init

This will initialize the git on your project

git add .

This will add all your files to the staging area

git commit -m "initial commit"

This will commit all your changes locally.

git remote add origin

This will add the remote url to your project

git push origin master

This will push all your changes to GitHub, now your source code is available on GitHub.

Create an Account in

You need to create a new account in in order to deploy your Spring boot application. Don’t worry, it will not ask you to enter your credit/debit card details. Once you create an account, login to your account, your dashboard that look like this


Create a new project

Click on the New Project option to create a new project


You can choose Empty Project, it will create an empty project with a random project name.


Create a new Service

A project may contain multiple services, so go inside the project and create a new Service


For now, click on empty service, this will create a new service with a random service name.


Generate a Domain

Once you create a service, we need to generate the domain for our service, click on the service, go to settings, under the domains section, click on Generate Domain, it will create random domain for us.


Deploy the application to the service

Under the service settings, you will see the service source option, you can click Connect Repo option


It will ask you to choose the repository that you want to deploy, choose the repository which we created


As soon as you select the repository, it will start deploying automatically, you can see that under the deployments in the settings


For the first time, it will take few minutes, wait till it finishes the deployment. Once the deployment is done, you will see the deployment completed status. You can visit the generated URL to see the application


That’s it for this post, if you like this post, share this with your friends and colleagues or you can share this within your social media platform. Thanks, I will see you in our next post.

About the author

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *