From the course: Creating Spring Boot Microservices
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Image file upload microservice - Spring Boot Tutorial
From the course: Creating Spring Boot Microservices
Image file upload microservice
- [Instructor] So let's look at my design that I've already put forward here, and I've populated some classes already for the project that you built for me, so the main domain model is a class called image in the model folder, and this is declared as @Document, and that is a MongoDB artifact. In JPA, they have entities; in MongoDB, they have documents, and a document is a collection, and I'm calling that images, so what is this image class? What are the attributes? The first is a String id, and this is an artifact from MongoDB having an identifier, which is a very long, unique string. Then I have my own attributes, which is the file name, and then an array of bytes, which is the actual data of the image file. Let's look at my controller, so I've already set up my controller with some information with Swagger of what this is, and I have a RequestMapping. The base URL is /api/images. Keep that in mind. We're going to look at that in the next chapter, why that's unique, and the folder…