From the course: Spring Cloud GCP: Setting Up a Cloud SQL Database
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using the Spring Data Cloud library
From the course: Spring Cloud GCP: Setting Up a Cloud SQL Database
Using the Spring Data Cloud library
- [Instructor] For this video, we are going to start using the database within our application and learn how to connect to the database and run queries against it. Our puzzle inventory application has access to the Spring Cloud SQL, and the Java Persistence API or JPA dependencies, as seen, in our palm.xml file lines 31 to 39. We know, spring provides a DataSource object bean for our app to access a physical Datasource like a database. The values we have in application.properties file, configure that DataSource bean to connect to cloud sequel. In our controller, we have access to a puzzle repository, which extends a JPA repository interface. When an application starts, this controller will get access to a repository bean responsible for communicating with the Cloud SQL database. We've defined the puzzle repository on line eight in our controller, but is not using the repository at all, just yet, so let's fix that. For our…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.