Adding messaging as a new component to an existing application
What have we built so far for our social media platform? We have the ability to upload and delete pictures. However, a key piece of any social media platform is to allow users to interact with each other. This is commonly done by either commenting on the social media content or chatting directly with each other.
Let's start by adding the ability to comment on images. But before we get going, let's stop and discuss the architecture.
For years, people have used the layer approach to split up applications. Fundamentally, we don't want a big application with all the classes in one package because it's too hard to keep up with everything.
So far, we have everything located in com.greglturnquist.learningspringboot
. Historically, the pattern has been to split things up in a domain layer, a services layer, and a controllers layer, as shown in the following screenshot:
In this structure, we would put every service into the services
subpackage...