- Notifications
You must be signed in to change notification settings - Fork0
el-moudni-hicham/microservices-spring-cloud-angular
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
• Spring Cloud Gateway • Eureka Discovery • Open Feign Rest Client • Hystrix DashBoardProject Class Diagram
![]() |
Create a new Spring project :
Selected dependencies
• Spring Web • Spring Data JPA • H2 Database• Rest Repositories • Lombok• Spring Boot DevTools• Eureka Discovery Client• Spring Boot ActuatorApplication Configuration
application.properties
spring.application.name=customer-servicespring.datasource.url=jdbc:h2:mem:customers-dbspring.cloud.discovery.enabled=true#management.endpoints.web.exposure.include=*server.port=8888
packagema.enset.customermicroservice.entites;importjakarta.persistence.Entity;importjakarta.persistence.GeneratedValue;importjakarta.persistence.GenerationType;importjakarta.persistence.Id;importlombok.AllArgsConstructor;importlombok.Data;importlombok.NoArgsConstructor;importlombok.ToString;@Entity@Data@NoArgsConstructor@AllArgsConstructor@ToStringpublicclassCustomer {@Id@GeneratedValue(strategy =GenerationType.IDENTITY)privateLongid;privateStringname;privateStringemail;}
packagema.enset.customermicroservice.repository;importma.enset.customermicroservice.entites.Customer;importorg.springframework.data.jpa.repository.JpaRepository;importorg.springframework.data.rest.core.annotation.RepositoryRestResource;@RepositoryRestResourcepublicinterfaceCustomerRepositoryextendsJpaRepository<Customer,Long> {}
DatabaseH2
Application Configuration
application.properties
spring.application.name=inventory-servicespring.datasource.url=jdbc:h2:mem:products-dbspring.cloud.discovery.enabled=trueserver.port=8889
- Create
Productentity - Create
ProductRepositorySpring Data based interface - Deploy Restful API of microservice with Spring Data Rest
- Microservice test
![]() | ![]() |
Selected dependencies
• Gateway • Spring Boot Actuator• Hystrix • Eureka Discovery Client
application.properties
spring.application.name=gateway-servicespring.cloud.discovery.enabled=trueserver.port=8890
application.yml
spring:cloud:gateway:routes: -id :r1uri :http://localhost:8888/predicates : -Path= /customers/** -id :r2uri :http://localhost:8889/predicates : -Path= /products/**
![]() | ![]() |
@BeanRouteLocatorrouteLocator(RouteLocatorBuilderbuilder){returnbuilder.routes() .route("r1", (r) ->r.path("/customers/**").uri("http://localhost:8888/")) .route("r2", (r) ->r.path("/products/**").uri("http://localhost:8889/")) .build(); }
![]() | ![]() |
Selected dependencies
• Eureka ServerEnableEurekaServer
@SpringBootApplication@EnableEurekaServerpublicclassEurekaDiscoveryApplication {publicstaticvoidmain(String[]args) {SpringApplication.run(EurekaDiscoveryApplication.class,args); }}
application.properties
server.port=8761#dontregisterserveritselfasaclient.eureka.client.fetch-registry=false#Doesnotregisteritselfintheserviceregistry.eureka.client.register-with-eureka=false
Static routes configuration with Discovery Service
@BeanRouteLocatorrouteLocator(RouteLocatorBuilderbuilder){returnbuilder.routes() .route("r1", (r) ->r.path("/customers/**").uri("lb://CUSTOMER-SERVICE")) .route("r2", (r) ->r.path("/products/**").uri("lb://INVENTORY-SERVICE")) .build(); }
![]() | ![]() |
Dynamic routes configuration with Discovery Service
@BeanDiscoveryClientRouteDefinitionLocatordefinitionLocator(ReactiveDiscoveryClientrdc,DiscoveryLocatorPropertiesdlp){returnnewDiscoveryClientRouteDefinitionLocator(rdc,dlp); }
![]() | ![]() |
Selected dependencies
• OpenFeign • Spring HATEOASService Test
![]() | |
![]() | ![]() |
Link toFront End part.
About
No description, website, or topics provided.
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.

















