0% found this document useful (0 votes)
20 views9 pages

Microservices with Spring Boot Guide

The document outlines the process of developing microservices using Spring Boot and Netflix Eureka Server, detailing the creation of 'student-service' and 'school-service' projects. It includes steps for setting up a service registry with Eureka, configuring application properties, and running the services. Additionally, it provides instructions for registering the services with Eureka and accessing their APIs through a browser.

Uploaded by

bhanu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views9 pages

Microservices with Spring Boot Guide

The document outlines the process of developing microservices using Spring Boot and Netflix Eureka Server, detailing the creation of 'student-service' and 'school-service' projects. It includes steps for setting up a service registry with Eureka, configuring application properties, and running the services. Additionally, it provides instructions for registering the services with Eureka and accessing their APIs through a browser.

Uploaded by

bhanu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Date:02/Feb/2023

----------------

Microservices

-------------

- Microservices is used to break up single large monolithic system into

multiple independent components

- In Monolithic system, all functionalities are part of single program

running in a single environment

Refer diagram Monolithic [Link]

- In case of Microservices architecture, the components are built and deployed

independently to integrate into a single larger system

Refer diagram Microservices [Link]


Netflix Eureka Server

---------------------

Netflix Eureka Server is used for building the service registry server and

Eureka Clients which wil register themselves and discover other services

to call REST APIs

Refer diagram Eureka [Link]


Developing a Microservice Application using Spring Boot and Eureka Server

-------------------------------------------------------------------------

- Create a Spring Starter Project "student-service" in STS

Click on File -> New -> Spring Starter Project

Name : student-service

Type : Maven

Java Version : 8

Group : student-service

Artifact : student-service

Package : [Link]

Click Next

In Project Dependencies add "Spring Web" and click Finish

- Update [Link] file of src/main/java folder to change the port number of

tomcat server

Refer program [Link]

- Create a Javabean class "Student" in [Link] package of src/main/java folder

Refer program [Link]

- Create a Rest Controller class "StudentServiceController" in [Link] package

Refer program [Link]


- Run the project "student-service" as Spring Boot App

Right click on student-service -> Run As -> Spring Boot App

- Open browser and type the following APIs

- [Link]

- [Link]
Date:03/Feb/2023

----------------

- Create a Spring Starter Project "school-service" in STS

Click on File -> New -> Spring Starter Project

Name : school-service

Type : Maven

Java Version : 8

Group : school-service

Artifact : school-service

Package : [Link]

Click Next

In Project Dependencies add "Spring Web" and click Finish

- Update [Link] file of src/main/resources folder of school-service

Refer program [Link]

- Create a Rest Controller class "SchoolServiceController" in [Link] package

Refer program [Link]

- Run the project "school-service" as Spring Boot App

- Open browser and type the following APIs

- [Link]
- [Link]

Configure Eureka Server in STS

------------------------------

- Create a Spring Starter Project "discovery-eureka-server" in STS

Click on File -> New -> Spring Starter Project

Name : discovery-eureka-server

Type : Maven

Java Version : 8

Group : discovery-eureka-server

Artifact : discovery-eureka-server

Package : [Link]

Click Next

In Project Dependencies add "Eureka Server" and click Finish

- Update [Link] file of "discovery-eureka-server"

Refer program [Link]

- Update "[Link]" file of [Link]

package by adding the following annotation

@EnableEurekaServer

Refer program [Link]


- Update [Link] file of discovery-eureka-server

Refer program [Link]

- Stop all other services

- Run "discovery-eureka-server" as Spring boot app

- Open browser and type the following url

[Link]

Note: Observe the instances registed with Eureka (No instances)

Register student-service and school-service into Eureka Service Registry

------------------------------------------------------------------------

- Update [Link] file of student-service

Refer program [Link]

- Update [Link] file of student-service

Refer program [Link]

- Update [Link] file of school-service

Refer program [Link]

- Update [Link] file of school-service

Refer program [Link]


- Run student-service and school-service as Spring Boot App

- Open browser and type the following url

[Link]

Note: Observe the instances registed with Eureka

- Update "[Link]" file of school-service

Replace "[Link] with "[Link]

Refer program [Link]

- Open browser and type the following APIs

- [Link]

- [Link]

Refer programs in [Link] file

You might also like