Creating a reactive repository

So far, we have been dabbling with Spring Data using our sample domain of employees. We need to shift our focus back to the social media platform that we started building in the previous chapter.

Before we can work on a reactive repository, we need to revisit the Image domain object we defined in the last chapter. Let's adjust it so that it works nicely with MongoDB:

    @Data 
    @Document 
    public class Image { 
 
      @Id final private String id; 
      final private String name; 
    } 

This preceding definition is almost identical to what we saw in the previous chapter, with the following differences:

  • We use @Document to identify this is a MongoDB domain object, but we accept Spring Data MongoDB's decision about what to name the collection ...

Get Learning Spring Boot 2.0 - Second Edition 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.