{"id":24617658,"url":"https://github.com/pacphi/spring-books","last_synced_at":"2026-04-17T02:33:21.918Z","repository":{"id":100006232,"uuid":"260068218","full_name":"pacphi/spring-books","owner":"pacphi","description":"A Project Reactor implementation of book inventory employing Java, Spring Boot and Cloud Spanner R2DBC dependencies.","archived":false,"fork":false,"pushed_at":"2021-03-16T18:50:09.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T21:34:24.184Z","etag":null,"topics":["gcp","java","project-reactor","r2dbc","spanner","spring-boot-2"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pacphi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-29T23:28:19.000Z","updated_at":"2021-03-16T18:50:11.000Z","dependencies_parsed_at":"2023-03-13T15:41:40.505Z","dependency_job_id":null,"html_url":"https://github.com/pacphi/spring-books","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pacphi/spring-books","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Fspring-books","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Fspring-books/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Fspring-books/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Fspring-books/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacphi","download_url":"https://codeload.github.com/pacphi/spring-books/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Fspring-books/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31912492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gcp","java","project-reactor","r2dbc","spanner","spring-boot-2"],"created_at":"2025-01-24T23:39:49.034Z","updated_at":"2026-04-17T02:33:21.840Z","avatar_url":"https://github.com/pacphi.png","language":"Java","readme":"# Spring Books Cloud Spanner R2DBC Sample\n\n\u003e A derivative work based upon the [cloud-spanner-spring-data-r2dbc-sample](https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc/tree/master/cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample).\n\n## Prerequisites\n\n* A valid GCP account and [project](https://cloud.google.com/resource-manager/docs/creating-managing-projects) id\n* [gcloud SDK](https://cloud.google.com/sdk/install)\n* JDK/JRE 11\n\nIf you want to run this sample on a Cloud Foundry foundation or Kubernetes cluster with [cf-for-k8s](https://github.com/cloudfoundry/cf-for-k8s) installed, then you'll need the\n\n* [cf CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html#pkg-linux)\n\nand valid account credentials\n\nIn addition your platform operator must have installed and configured the [gcp-service-broker](https://github.com/GoogleCloudPlatform/gcp-service-broker).\n\n## Clone\n\n```\ngit clone https://github.com/pacphi/spring-books.git\n```\n\n## Build\n\n```\ncd spring-books\n./gradlew build\n```\n\n## Run\n\nThis sample creates a table called `BOOK` on application startup, and deletes it prior to application shutdown.\n\n### Locally\n\nRun the sample from the command line, providing the following properties\n\n* `spanner.instance`\n* `spanner.database`\n* `gcp.project`\n* `gcp.service_account_key_json_file`\n\n```\n./gradlew bootRun -Dspring-boot.run.jvmArguments=\"-Dspanner.instance={SPANNER-INSTANCE} -Dspanner.database={SPANNER-DATABASE} -Dgcp.project={GCP-PROJECT} -Dgcp.service_account_key_json_file={PATH-TO-ACCOUNT-KEY-JSON-FILE}\"\n```\n\nVisit http://localhost:8080/index.html in your favorite browser.\n\n\n### on cf-for-k8s\n\nLogin to a foundation and target an organization and space\n```\ncf api {api-host}\ncf auth {username} {password}\ncf t -o {organization} -s {space}\n```\n\nCreate a Google Spanner service instance\n\n```\ncf create-service google-spanner sandbox spanner-sandbox-instance\n```\n\nFetch the instance id of the spanner-sandbox-instance\n\n```\ngcloud spanner instances list\n```\n\u003e Note the `NAME` of the instance\n\n\nCreate a database within the instance\n\n```\ngcloud spanner databases create library --instance={name}\n```\n\u003e Replace the occurrence of `{name}` above with instance name of your spanner-sandbox-instance.\n\n\u003e A single service instance may support multiple databases. In this case we're creating a database named `library`.\n\nPush the app (but don't start it up)\n\n```\ncf push --no-start\n```\n\u003e The supplied `manifest.yml` sets the required environment variables.\n\n\u003e Java Config via [java-cfenv](https://github.com/pivotal-cf/java-cfenv) will take care to auto-fetch Google Spanner instance credentials at startup which are used to setup a connection and support on-demand database transactions.\n\nBind the Google Spanner service instance to the app\n\n```\ncf bind-service spring-books spanner-sandbox-instance\n```\n\nSet an environment variable\n\n```\ncf set-env spring-books GCP_SERVICE_ACCOUNT_KEY_JSON '{key-file-contents}'\n```\n\n\u003e We need to set an environment variable that contains the content of the service account JSON key file in order to authenticate requests from the application to the Google Spanner instance. Replace `{key-file-contents}` above with an actual service account key in JSON format.\n\nStart the app\n\n```\ncf start spring-books\n```\n\nVisit the route for the app you just pushed in your favorite browser.\n\n## What does this app do?\n\nBasically allows a librarian to maintain a simple inventory of books.\n\nTry the different actions available:\n\n* listing books\n* adding a new book\n* searching for a book by its ID\n\n## Teardown\n\n```\ncf unbind-service spring-books spanner-sandbox-instance\ncf delete-service spanner-sandbox-instance -f\ncf delete spring-books -r -f\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacphi%2Fspring-books","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacphi%2Fspring-books","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacphi%2Fspring-books/lists"}