31
What is Microservice? - Aime -

Micro service and Hello World with JAVA Spring Framework

Embed Size (px)

Citation preview

Page 1: Micro service and Hello World with JAVA Spring Framework

What isMicroservice?

- Aime -

Page 2: Micro service and Hello World with JAVA Spring Framework

Today’sContents

● What is Microservice● Benefits and Drawbacks● Spring vs Microservice● Getting Started with

Spring framework and Microservice

● Example - Order Microservice System by Spring Framework

Page 3: Micro service and Hello World with JAVA Spring Framework

WHAT is

Microservice

Page 4: Micro service and Hello World with JAVA Spring Framework

a particular way of designing software applications as suites of independently deployable services.

“”- http://martinfowler.com

Page 5: Micro service and Hello World with JAVA Spring Framework

microservices is a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs.

“”- Wikipedia

Page 6: Micro service and Hello World with JAVA Spring Framework

Micro-services are not 1 million services that make up a single service.

Micro-services are also not many large services each covering a bunch of functionality and interacting via databases or an ESB in a large enterprise system

micro-services are not necessarily independently deployable

Instead of focusing on the services being independently deployable, it is sufficient to choose groups of services that can be deployed independently.

“”- David, http://davidmorgantini.

blogspot.kr/

Page 7: Micro service and Hello World with JAVA Spring Framework

what is

Microservice ?

Page 8: Micro service and Hello World with JAVA Spring Framework

Characteristic of “MicroService” small scope

standalone

can integrate with other service via interface

(should) have it own database

Page 9: Micro service and Hello World with JAVA Spring Framework

Difference between

MicroserviceMONOLithic &

Page 10: Micro service and Hello World with JAVA Spring Framework

Difference between “Monolithic” and “microservice” - Conceptpicture from eugenedvorkin.com

Page 11: Micro service and Hello World with JAVA Spring Framework

Difference between “Layered Architecture” and “microservice” - architecturepicture from martinfowler.com

Page 12: Micro service and Hello World with JAVA Spring Framework

Difference between “Layered Architecture” and “microservice” - developmentpicture from martinfowler.com

Page 13: Micro service and Hello World with JAVA Spring Framework

Benefits of

Microservice

Page 14: Micro service and Hello World with JAVA Spring Framework

Benefits of “MicroService” Independent

Easy to Understand

More Productive

Speed up deployment

Easier to scale

Improve fault isolation

Page 15: Micro service and Hello World with JAVA Spring Framework

DRAWBACKs ...

Page 16: Micro service and Hello World with JAVA Spring Framework

Drawbacks ...Developer has to deal with developing distributed system

Tool Support More Difficult on Testing

Inter-Service Communication Mechanism

Memory Consumption

Communication between teams

Use Cases

Page 17: Micro service and Hello World with JAVA Spring Framework

Nowaday...

Page 18: Micro service and Hello World with JAVA Spring Framework

SPRing vs microservice

Page 19: Micro service and Hello World with JAVA Spring Framework

https://spring.io/tools

Page 20: Micro service and Hello World with JAVA Spring Framework
Page 21: Micro service and Hello World with JAVA Spring Framework

Getting Started

File > New >Maven Project

Page 22: Micro service and Hello World with JAVA Spring Framework

Check “Skip archetype selection” > Next > Enter Group id and Artifact id > Finish

Page 23: Micro service and Hello World with JAVA Spring Framework

Open “pom.xml” > Add <parent> and each <dependency>● to make a microservice, it needs to add spring-boot dependency

Page 24: Micro service and Hello World with JAVA Spring Framework

Create “main” and “main.rest” packages under src/main/java

“main” is for storing main(), identifying Spring, Configuration“main.rest” is for making RESTful WS, API, other components

Page 25: Micro service and Hello World with JAVA Spring Framework

Create “Application” and “ApplicationConfig” class under src/main/java/main

“Application” contains main() and Defines Spring boot“ApplicationConfig” contains Jersey configuration

Page 26: Micro service and Hello World with JAVA Spring Framework

Create “HelloWorld” and “HelloWorldRest” class under src/main/java/main/rest

“Hello” contains application model“HelloWorldRest” provides API* you can move “Hello” to other package, i.e., main.model, as well if needed

Page 27: Micro service and Hello World with JAVA Spring Framework

Run as Spring Boot App

Page 28: Micro service and Hello World with JAVA Spring Framework

Run Configuration ...

Page 29: Micro service and Hello World with JAVA Spring Framework

On Console

Page 30: Micro service and Hello World with JAVA Spring Framework

GET Request

Page 31: Micro service and Hello World with JAVA Spring Framework

Microservice Example