-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Spanner - R2DBC - Spring data sample #214
Conversation
...-samples/cloud-spanner-spring-data-r2dbc-sample/src/main/java/com/example/WebController.java
Show resolved
Hide resolved
Very nicely done; just 1 comment about the index.html thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just some polishing nits.
cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/README.adoc
Outdated
Show resolved
Hide resolved
cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/README.adoc
Show resolved
Hide resolved
cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/pom.xml
Outdated
Show resolved
Hide resolved
cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/pom.xml
Show resolved
Hide resolved
cloud-spanner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/pom.xml
Show resolved
Hide resolved
...ner-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/src/main/java/com/example/Book.java
Outdated
Show resolved
Hide resolved
...samples/cloud-spanner-spring-data-r2dbc-sample/src/main/java/com/example/BookRepository.java
Outdated
Show resolved
Hide resolved
...les/cloud-spanner-spring-data-r2dbc-sample/src/main/java/com/example/SpringDataR2dbcApp.java
Outdated
Show resolved
Hide resolved
...er-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/src/main/resources/static/index.html
Show resolved
Hide resolved
...er-r2dbc-samples/cloud-spanner-spring-data-r2dbc-sample/src/main/resources/static/index.html
Show resolved
Hide resolved
Co-Authored-By: Mike Eltsufin <meltsufin@google.com>
<dependency> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>cloud-spanner-r2dbc</artifactId> | ||
<version>0.1.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these version numbers just be <version>${project.version}</version>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes. Definitely should not be hardcoded.
I made spring-boot-parent the parent, which is messing with project.version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look -- I've added a hardcoded project version instead. This is necessary because the parent is a spring boot starter. I don't know; I might just get rid of the starter parent in a follow-up and add the spring boot maven plugin and spring artifact versions to the samples parent.
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
<version>2.2.4.RELEASE</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this version number necessary? If so, should be it be the same as the parent starter which is <version>2.2.3.RELEASE</version>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch; it should actually just derive its version from the spring boot parent.
This sample creates a table called BOOK on application startup, and deletes it prior to application shutdown.
It provides three endpoints showing Spring Data R2DBC manipulation of Cloud Spanner data:
/list
returns all books in theBOOKS
table using the autoconfiguredDatabaseClient
./add
inserts a book using the semantic insert in the autoconfiguredDatabaseClient
./search/{id}
finds a specific book by ID using Spring Data R2DBC repository.I owe an integration test, which I'd like to add in a follow-up PR.