Let’s start creating a Spring Boot application..

  1. install STS ..download from here.. [Eclipse of your choice]
  2. Installing maven to run from command line
    https://codinko.wordpress.com/2015/12/02/maven-local-installation/3. Create a simple spring boot from maven archetype.mvn archetype:generate -DarchetypeGroupId=org.springframework.boot -DarchetypeArtifactId=spring-boot-sample-simple-archetype -DarchetypeVersion=1.0.2.RELEASE -DgroupId=com.codinko.code.cloud.springboot4 -DartifactId=cloud-springboot4 -Dversion=1.0.0-SNAPSHOTmvn-archetype-springboot.JPG
    // succesfully created..  Project created from Archetype in dir: D:\space.. BUILD SUCCESS

Import the project as maven project in your eclipse/STS workspace.

4. Create a Spring boot application in STS [Spring Tool Suite].

Reference: https://spring.io/blog/2015/03/18/spring-boot-support-in-spring-tool-suite-3-6-4

New -> Spring starter project -> packaging jar,type Maven, dependencies :web [support full stack web development including Tomcat and spring-webmvc]..

This is a web app. Let’s add a HelloController with a REST api that prints the name passed as parameter.
Right click on project and Run as Spring boot..


  • http://localhost:8888/hello?name=codinko

In Application.properties, we have an entry :  server.port=8888


Note: If you don’t have STS, the easy way is to use this online tool:    https://start.spring.io/


Running a Boot App in STS
–  Spring boot apps created by the wizard come in two flavors ‘jar’ or ‘war’.
– The Starter wizard let’s you choose between them in its ‘packaging’ option.

A great feature of spring-boot is that you can easily create standalone ‘jar’ packaged projects that contain a fully functional embedded web server.

All you need to do to run your app, is run its Java Main type, just like you do any other plain Java application.

This is a huge advantage as you don’t have to mess around with setting up local or remote Tomcat servers, war-packaging and deploying.

If you really want to do things ‘the hard way’ you can still choose ‘war’ packaging.

However there’s really no need to do so because:

  • you can convert your ‘jar’ app to a ‘war’ app at any time
  • the Cloud Foundry platform directly supports deploying standalone Java apps.


Read more and Try this compulsory exercise mentioned here:

Let’s push our project to github..

Go to github and create a repository.  let’s name it hello-boot.

The next page gives you these steps:
Open Git bash
cd existing_folder
git init
git remote add origin https://github.com/codinko/hello-boot.git
git commit -m “first commit”
git push -u origin master

When prompted, enter your credentials.
In Git repositories view, add existing local repo that you just created to view it from eclipse/ STS.


To understand a Spring Boot application that we just now created, its is mandatory to read this article. 


Pending to read: http://projects.spring.io/spring-boot/

Cloud Foundry / PCF/ PWS

Cloud Foundry is an Open source PaaS, provides a fast and easy way to build, test, deploy and scale applications.
Pivotal Web Services, is an instance of PCF hosted by Pivotal.

  • Install Cloud Foundry Command Line Interface:
    Test your installation by opening a terminal window and type cf. If your installation was successful, you can see the cf CLI help listing.
  • Register PWS [Pivotal Web Services] account.
    Pivotal provides free access for 1 year to Pivotal public cloud. Practice yourself!
    Create a Pivotal account – https://login.run.pivotal.io/login
  • Assuming you already have github account, and gitbash installed.

CLI Basics:

Login to the CLI
$ cf login -a api.run.pivotal.io
Get help in the CLI
$ cf help
Push an application
$ cf push your_app

Next Steps:
Install the CLI, Clone the app, Deploy the app to PWS thru CLI, view the logs:
Follow the below link to deploy a sample app [This one explains the project you can clone from github, how to push that app to PWS. Hence we are not repeating those steps here. Please read below one]


cf auth email pwd  // this one worked from cygwin in windows

[The below one also works from windows terminal:
cf login -a https://api.run.pivotal.io –skip-ssl-validation -o yourorg -s yourspace ]

Then  cf push

$ cf push
No org and space targeted, use ‘cf target -o ORG -s SPACE’ to target an org and space

– Go to your PWS account and find name of your ORG and SPACE

$ cf target -o my-org -s development

Now do $ cf push




Find logs:

cf logs cf-spring –recent

If you have a simple app created in STS, and you try to push the jar to PCF, it fails.
Because for deploying an app in PCF, the app needs to have  manifest.yml file.
When you do cf push, it is the manifest.yml that communicates to cf push, on how to deploy your application to PCF.

You can refer manifest.yml of the previous app, or refer the one below.

Lets create a sample app – https://github.com/codinko/hello-boot.git

Listing the HelloController.java, manifest.yml and application.properties for quick reference.

Let’s create the manifest.yml

Now do  cf login and cf push  application name

cf login -a https://api.run.pivotal.io –skip-ssl-validation -o codinko-org -s development

cd to project directory

cf push hello-boot



Let’s see the dashboard and our app from PCF





Connect to database:


How to connect this app to a mysql database/ add a mysql service – we’l cover soon..