Building a sample application

The basic example is available in the master branch. The more advanced sample, with embedded MongoDB, is committed to the mongo branch. In case you would like to try running more advanced sample, you need to switch to that branch using git checkout mongo. Now, we need to perform some changes in the model class to enable object mapping to MongoDB. The model class has to be annotated with @Document and the primary key field with @Id. I also changed the ID field type from Long to String because MongoDB generates primary keys in UUID format, for example, 59d63385206b6d14b854a45c:

@Document(collection = "person")public class Person {    @Id    private String id;    private String firstName;    private String lastName; private ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.