Read Me First
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:run
or inside the IDE). -
Check the endpoints using
curl localhost:8080/api/profiles
-
Edit
application.properties
and uncommentspring.data.rest.detection-strategy=annotated
switching 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
/users
endpoint has disappeared. -
Open
UserRepository
and add the@RepositoryRestResource
annotation. -
Restart the application (again, leaving the Docker instance of Cassandra up).
-
Verify that
/users
endpoint 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.