![Page 1: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/1.jpg)
What isMicroservice?
- Aime -
![Page 2: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/2.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/3.jpg)
WHAT is
Microservice
![Page 4: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/4.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/5.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/6.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/7.jpg)
what is
Microservice ?
![Page 8: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/8.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/9.jpg)
Difference between
MicroserviceMONOLithic &
![Page 10: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/10.jpg)
Difference between “Monolithic” and “microservice” - Conceptpicture from eugenedvorkin.com
![Page 11: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/11.jpg)
Difference between “Layered Architecture” and “microservice” - architecturepicture from martinfowler.com
![Page 12: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/12.jpg)
Difference between “Layered Architecture” and “microservice” - developmentpicture from martinfowler.com
![Page 13: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/13.jpg)
Benefits of
Microservice
![Page 14: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/14.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/15.jpg)
DRAWBACKs ...
![Page 16: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/16.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/17.jpg)
Nowaday...
![Page 18: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/18.jpg)
SPRing vs microservice
![Page 19: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/19.jpg)
https://spring.io/tools
![Page 20: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/20.jpg)
![Page 21: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/21.jpg)
Getting Started
File > New >Maven Project
![Page 22: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/22.jpg)
Check “Skip archetype selection” > Next > Enter Group id and Artifact id > Finish
![Page 23: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/23.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/24.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/25.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/26.jpg)
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](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/27.jpg)
Run as Spring Boot App
![Page 28: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/28.jpg)
Run Configuration ...
![Page 29: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/29.jpg)
On Console
![Page 30: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/30.jpg)
GET Request
![Page 31: Micro service and Hello World with JAVA Spring Framework](https://reader031.vdocuments.site/reader031/viewer/2022030305/58742faf1a28ab72188b74e9/html5/thumbnails/31.jpg)
Microservice Example