Mr.DevEng
Mr.DevEng

Reputation: 2421

Microservice project structure using Spring boot and Spring Cloud

I am trying to convert a normal monolithic web application into microservices structure using Spring Boot and Spring Cloud. I am actually trying to create Angular 2 front-end application and calls these my developed microservices in the cloud. And I am already started to break the modules into independent process's structure for microservice architecture.

Here my doubt is that, when designing the flow of control and microservice structure architecture, can I use only one single Spring Boot project using different controller for this entire web application back end process?

Somewhere I found that when I am reading develop all microservices using 2 different Spring Boot project. I am new to Spring and Spring Cloud. Is it possible to create all services in single project by using different modules?

Upvotes: 2

Views: 10779

Answers (3)

soyphea
soyphea

Reputation: 609

Currently I am working on microservices too, according my experience we have designed microservices as step below,

  • Maven

    • You should create the project with different project. But actually you can separate your project to submodule. So you will be easy to manage your project, the submodule you can use with other project too.
    • Build the Jar Library put your local repository. it can save your time, you have just find the same component or your functionality then build the jar file put in your local repository , so every project that use this function call point to download this repository, you don't have to write many project same same.

So finally I would like you to create different springboot project, but just create submodule and build local repository.

Upvotes: 3

alayor
alayor

Reputation: 5025

By creating your modules in different projects you create a more flexible solution.

You could even use different languages and technologies in a service in particular. E.g. one of your services could be NodeJS and the rest Java/Spring.

Upvotes: 1

LHCHIN
LHCHIN

Reputation: 4009

Actually, it doesn't matter to package all those services into ONE project. But in micro-service's opinion, you should separate them into many independent projects. There are several questions you can ask yourself before transforming original architecture.

  • Is your application critical? Can user be tolerant of downtime while you must re-deploying whole package for updating only one service?
  • If there is no any dependency between services, why you want to put them together? Isn't it hard to develop or maintain?
  • Is the usage rate of each service the same? Maybe you can isolate those services and deploy them which are often to be invoked to a strong server.

Try to read this article Adopting Microservices at Netflix: Lessons for Architectural Design to understand the best practices for designing a microservices architecture. And for developing with Spring Cloud, you can also read this post Spring Cloud Netflix to know which components you should use in your architecture.

Upvotes: 4

Related Questions