Stay organized with collections
Save and categorize content based on your preferences.
These instructions will walk you through deploying the Cloud Foundry Spring
Music reference App using the Kf Cloud Service Broker for Google Cloud.
Building Java Apps from source: The Spring Music source will be built on
the cluster, not locally.
Service broker integration: You will create a database using the Kf Cloud Service Broker and bind the Spring Music App to it.
Spring Cloud Connectors: Spring Cloud
Connectors are used by the Spring Music App to
detect things like bound CF services. They work seamlessly with Kf.
Configuring the Java version: You will specify the version of Java you
want the buildpack to use.
Edit manifest.yml, and replace path: build/libs/spring-music-1.0.jar with stack: org.cloudfoundry.stacks.cflinuxfs3. This instructs Kf to build from source using cloud native buildpacks so you don't have to compile locally.
The deployed App includes a UI element showing which (if any) Spring profile is being used. No profile is being used here, indicating an in-memory database is in use.
Create and bind a database
Create a PostgresSQL database from the marketplace.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Deploy Spring Music\n\nThese instructions will walk you through deploying the [Cloud Foundry Spring\nMusic](https://github.com/cloudfoundry-samples/spring-music) reference App using the Kf Cloud Service Broker for Google Cloud.\n\n1. **Building Java Apps from source**: The Spring Music source will be built on\n the cluster, not locally.\n\n2. **Service broker integration**: You will create a database using the Kf Cloud Service Broker and bind the Spring Music App to it.\n\n3. **Spring Cloud Connectors** : [Spring Cloud\n Connectors](https://cloud.spring.io/spring-cloud-connectors/) are used by the Spring Music App to\n detect things like bound CF services. They work seamlessly with Kf.\n\n4. **Configuring the Java version**: You will specify the version of Java you\n want the buildpack to use.\n\nPrerequisites\n-------------\n\n### Install and configure Kf Cloud Service Broker\n\n1. [Deploy Kf Cloud Service Broker](/migrate/kf/docs/2.4/how-to/deploying-cloud-sb).\n\nDeploy Spring Music\n-------------------\n\n### Clone source\n\n1. Clone the [Spring Music repo](https://github.com/cloudfoundry-samples/spring-music).\n\n git clone https://github.com/cloudfoundry-samples/spring-music.git spring-music\n cd spring-music\n\n2. Edit `manifest.yml`, and replace `path: build/libs/spring-music-1.0.jar` with `stack: org.cloudfoundry.stacks.cflinuxfs3`. This instructs Kf to build from source using [cloud native buildpacks](/blog/products/containers-kubernetes/google-cloud-now-supports-buildpacks) so you don't have to compile locally.\n\n ---\n applications:\n - name: spring-music\n memory: 1G\n random-route: true\n stack: org.cloudfoundry.stacks.cflinuxfs3\n env:\n JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'\n # JBP_CONFIG_OPEN_JDK_JRE: '{ jre: { version: 11.+ } }'\n\n### Push Spring Music with no bindings\n\n1. Create and target a Space.\n\n kf create-space test\n kf target -s test\n\n2. Deploy Spring Music.\n\n kf push spring-music\n\n3. Use the proxy feature to access the deployed App.\n\n 1. Start the proxy:\n\n kf proxy spring-music\n\n 2. Open `http://localhost:8080` in your browser:\n\n The deployed App includes a UI element showing which (if any) Spring profile is being used. No profile is being used here, indicating an in-memory database is in use.\n\n### Create and bind a database\n\n1. Create a PostgresSQL database from the marketplace.\n\n **Note:** You must set the `COMPUTE_REGION` and `VPC_NAME` variables so Kf Cloud Service Broker knows where to provision your instance, and authorize the VPC Kf Apps run on to access it. \n\n kf create-service csb-google-postgres small spring-music-postgres-db -c '{\"region\":\"\u003cvar translate=\"no\"\u003eCOMPUTE_REGION\u003c/var\u003e\",\"authorized_network\":\"\u003cvar translate=\"no\"\u003eVPC_NAME\u003c/var\u003e\"}'\n\n2. Bind the Service with the App.\n\n kf bind-service spring-music spring-music-postgres-db\n\n3. Restart the App to make the service binding available via the VCAP_SERVICES environment variable.\n\n kf restart spring-music\n\n4. (Optional) View the binding details.\n\n kf bindings\n\n5. Verify the App is using the new binding.\n\n 1. Start the proxy:\n\n kf proxy spring-music\n\n 2. Open `http://localhost:8080` in your browser:\n\n You now see the Postgres profile is being used, and we see the name of our Service we bound the App to.\n\nClean up\n--------\n\n1. Unbind and delete the PostgreSQL service:\n\n kf unbind-service spring-music spring-music-db\n kf delete-service spring-music-db\n\n2. Delete the App:\n\n kf delete spring-music"]]