I previously blogged how to PUSH an application into PCF , then bind services as shown below.
If you want to do this in one step simply create a manifest file as shown below. This example isn't the spring books application but shows you what your manifest.yml would look like with services included so you could then create one similar to that below.
1. Create a manifest.yml file as follows
manifest.yml
applications:
- name: pas-springtravel
memory: 512M
instances: 1
host: pas-springtravel
domain: cfapps.io
path: ./travel.war
services:
- dev-mysql
2. Push the application and bind to the services at push time.
[Tue Feb 18 20:13:01 papicella@:~/vmware/pivotal/products/cloud-foundry/apps/spring-travel ] $ cf push -f manifest.yml
Using manifest file manifest.yml
Creating app pas-springtravel in org papicella-org / space development as papicella@gopivotal.com...
OK
Creating route pas-springtravel.cfapps.io...
OK
Binding pas-springtravel.cfapps.io to pas-springtravel...
OK
Uploading pas-springtravel...
Uploading from: travel.war
5.3M, 2748 files
OK
Binding service dev-mysql to pas-springtravel in org papicella-org / space development as papicella@gopivotal.com
OK
Starting app pas-springtravel in org papicella-org / space development as papicella@gopivotal.com...
OK
-----> Downloaded app package (22M)
-----> Uploading droplet (62M)
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running
App started
Showing health and status for app pas-springtravel in org papicella-org / space development as papicella@gopivotal.com...
OK
requested state: started
instances: 1/1
usage: 512M x 1 instances
urls: pas-springtravel.cfapps.io
state since cpu memory disk
#0 running 2014-02-18 08:24:58 PM 0.5% 458.6M of 512M 149.9M of 1G
3. The application using the MYSQL service