To run this application, carry out these steps.
-
Install Docker.
-
Run Docker:
docker run -p 9042:9042 cassandra. (Wait for it to come up. It can take over a minute). -
Run the application (either
./mvnw spring-boot:runor inside the IDE). -
Check the endpoints using
curl localhost:8080/api/profiles -
Edit
application.propertiesand uncommentspring.data.rest.detection-strategy=annotatedswitching to annotation-based discovery. -
Restart this app (but leave the Docker instance of Cassandra running).
-
Revisit the profiles with
curl localhost:8080/api/profiles. -
Observe that
/usersendpoint has disappeared. -
Open
UserRepositoryand add the@RepositoryRestResourceannotation. -
Restart the application (again, leaving the Docker instance of Cassandra up).
-
Verify that
/usersendpoint is back withcurl localhost:8080/api/profiles.
This verifies that Spring Data Cassandra + Spring Data REST works as expected whether or not you are using the default policy for exporting Spring Data REST, or if you switch to annotation-only.