简体   繁体   中英

What is Microservices and is there a connection with MVC

I'm familiar with spring boot framework and I developed an Application which helps to handle online Assignments.I used few service classes to handle different tasks of the application and its structure can be seen here.

我的项目的文件结构

And I have seen several complex applications built as independent packages based on the task it do in the application.

(1) My First question is can my Application be called as a MicroServices Application?? Because I have used independent services for the application development.

(2) And my second question is Can a application developed in MicroServices Architecture has MVC Architecture at the same time.But I have seen in several tutorials they are 2 different architectures.But a Moicroservices Application also has Models ,Views and Controllers at the same time.

So can those 2 be used at the same time??

Thank you!!

Microservices according to Chris Richardson ( recognized thought leader in microservices) is Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are

Highly maintainable and testable Loosely coupled Independently deployable Organized around business capabilities Owned by a small team The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.

It is way of delivery and based on 12 factors https://12factor.net/ . We use domain driven design as one of the way.

MVC is way of designing as service where we have model view and controller.

In Microservices architecture we can use MVC in one way where each component will be distributed .

Please go through the Microservice Patterns. It is very good book to understand the Microservices architecture

1.Answer to your question yes your application can be Microservices if it followed the 12 factors as mentioned in the website .

  1. Yes Microservices can be on the pattern of mvc but they will be distributed and like we have Microservices for backend in similar fashion we have micro frontend for UI .

You should do some deeper research yourself about the concept and theory of microservices. Studying other applications without the basic knowledge can be misleading.

(1) Just because you are using multiple classes called services does not mean, you are building microservices application. Microservice application examples can be - student management rest api, question and answer management rest api, UI for administration, UI for public usage etc. All of them can be separate spring boot apps, or any other technology capable of handling the requirements (node.js, python, php, Asp.net ...) You should be able to deploy, test and use them as separate standalone apps.

(2)I think a microservice app does not need views, it can be a rest/soap app, log aggregation app, health check app, messaging service app etc. But different types can use different architecture, one of which can be MVC.

By definition of M. Fowler microservices are

..an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

As you see the definition is ambiguous. I think you are building a monolith application with a good separation of responsibilities into classes called XyServices - a possible candidates to migrate to microservices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM