Running Spring Boot Application on SAP Cloud Platform

Cloud Foundry and Neo Environment

SAP Cloud Platform supports running J2EE applications. But most develops are not building Java Web Application from EJB/Servlet any more. They rather use framework to build up their app. Spring Framework from Pivotal is a popular one which you can build rapidly with just a few lines of codes and it is open source.

Getting a Spring Boot app running on SAP Cloud Platform is not so strait-forward as the platform already provides Tomcat container and some other stuffs which interfere with Spring Boot libraries so you need to work a bit more to get them running properly on the platform.

The introduction of SCP on Cloud Foundry makes also it easier to run. So in this guide, I will show you how to build a Hello World Spring Boot app on Cloud Foundry platform then will show what you need to do more to get it run on SAP-own Neo environment.

Create a Hello World Application

Create a new Maven project.

A New Project Named ‘spring-boot-helloscp’

Populate the pom.xml file with the following:

Create a package and create your application class:

Create a (REST)controller class and define your endpoint:

Build and test running your application and you should see a hello message at http://localhost:8080/

Build and Deploy on SCP Cloud Foundry

To deploy Spring Boot App on Cloud foundry environment, you need to exclude spring-boot-starter-tomcat from the JAR file by include the following in the pom.xml


The tag <scope>provided</scope> means this library is already provided on the platform so no need to include it in the JAR.

Rebuild your project and upload deploy JAR file on SCP CF.

Deploying Application on SCP Cloud Foundry Environment

Note: If you don’t want to input application properties every time, you can create manifest.yml and select Use Manifest when deploying. See a sample of manifest file from here.

Wait until the application is started and turned green.

Application Dashboard on Cloud Foundry Environment

Click the URL to access your application.

Spring Boot Application on Cloud Foundry Environment

Deploy using Command Line Interface (CLI)

Deploying JAR file via the web interface most of the time fails with unknown error. There’s no log file telling you the root cause either.

Deploying JAR file Result in Unknown Error

So let’s use CF CLI to push codes to Clous Foundty and let it build and deploy for us.

Before we use the command, make sure to create manifest.yml first.

Log in to Cloud Foundry environment.

$ cf api
Setting api endpoint to
api endpoint:
api version: 2.94.0
Not logged in. Use 'cf login' to log in.


$ cf login
API endpoint:
Email> xxxxx@xxxxx.comPassword>
Targeted org Xxxxxxxxxxxtrial_trialTargeted space devAPI endpoint: (API version: 2.94.0)

After log in, then you can use command cf push. Then you should see something like this:

Showing health and status for app app12345 in org Xxxxxxxxxxxtrial_trial / space dev as
requested state: started
instances: 1/1
usage: 512M x 1 instances
last uploaded: Sun Oct 1 04:24:50 UTC 2017
stack: cflinuxfs2
buildpack: client-certificate-mapper=1.3.0_RELEASE container-security-provider=1.10.0_RELEASE java-buildpack=v3.19- java-main open-jdk-like-jre=1.8.0_144 open-jdk-like-memory-calculator=2.0.2_RELEASE open-...
state since cpu memory disk details
running 2017-10-01 11:26:01 AM 49.5% 282.1M of 512M 142M of 512M

This means your application is deployed and started.

Deployed Application via CF CLI

Refer this page for instructions to install CF CLI.

Build and Deploy on Neo Environment

Include one more provided dependency in pom.xml:


Make the build to WAR by also adding this tag. Neo does not support JAR!


Make sure your application is extending SpringBootServletInitializer and override method configure. This will tells the platform which endpoint to bind and expose. Otherwise, you cannot access your application and always get 404 Not Found.

Build your application and deploy WAR file to SCP Neo.

Deploying Application on SCP Neo Environment

Start your application and click URL to access your application.

Application Dashboard on Neo Environment
Spring Boot Application on Neo Environment

Note: If you want to access your application at root URI then change finalName to ROOT in pom.xml (Any better way?!?)


Deploying Options

Apart from web cockpit, you can deploy your application from Eclipse IDE or Console Client. For more information, check out this documentation:

Source Codes

My source codes are available at GitHub:

Make JAR, not WAR.



-- |

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chairat Onyaem (Par)

Chairat Onyaem (Par) |

More from Medium