Deploy a Spring Boot Application to Pivotal Web Services


Spring Boot makes it easy to create stand-alone applications based on the Spring framework. Pivotal is the company behind the Spring framework. Pivotal is also running a cloud platform  called Pivotal Web Services (PWS). PWS provides a run time environment for several types of server based applications and PWS are particularly suitable for Spring Boot applications. If you are looking for a way to run your Spring Boot application „in the cloud“ take a look  at PWS. In this article I will show how to deploy a simple Spring Boot application in the  PWS environment.

First you have to create an account for Pivotal Web Services (PWS). Sign up for free here. Note that you have to pay for PWS if you want to use it as a run time environment for an application. Although Pivotal offers $87 of free trial credit which is enough to keep a simple application online for several weeks there is no free tier to run a simple application permanently.

After creating the account go to the PWS console, which is the web based administration tool for PWS. You have to add an org and a space in the PWS console. You will need the name of the org and the space later as parameters in the deployment process of your application. Check the PWS documentation for a detailed description of the PWS system and the console.

Next step is the installation of the Cloud Foundry Command Line Interface (cf CLI), a tool you use to deploy and manage your PWS applications. Please read the relevant chapter in the PWS manual: Cloud Foundry Command Line Interface.

This article shows the PWS deployment process of a Spring Boot with the example of a simple web service you can find in a GitHub repository: murygin/spring-rest-service.

Follow the instructions to deploy the application. Java 8 is required for compilation.

Step 1: Clone the repository with git, build and package the application with maven

git clone
cd spring-rest-service
mvn package

Step 2 (optional): Run & test the application locally


cd spring-rest-service
java -jar spring-rest-service/target/gs-rest-service-0.1.0.jar


curl http://localhost:8080/greeting?name=world

Expected Output:

{"id":1,"content":"Hello, world!"}

Step 3: Edit deployment configuration

Edit PWS / Cloud Foundry deployment configuration in file spring-rest-service/manifest.yml:

 path: target/gs-rest-service-0.1.0.jar

You have to edit the property name. Choose a name which is unique for PWS.

Step 4: Deployment


Login to PWS with the Cloud Foundry command line interface.

cf login -a


cd spring-rest-service
cf push


Suppose you have chosen ilovespring as name in step 3 run the following command to test your deployment:


Expected Output:

{"id":1,"content":"Hello, Spring!"}
  1. No trackbacks yet.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

%d Bloggern gefällt das: