Commit ff12db53 authored by mohammad.salama's avatar mohammad.salama

Services Are Working And Registering , But GateWay NOT WORKING

parent 0e45f7d5
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="CloudGateway" options="-parameters" />
<module name="DataBase" options="-parameters" /> <module name="DataBase" options="-parameters" />
<module name="DiscAndReg" options="-parameters" /> <module name="DiscAndReg" options="-parameters" />
<module name="UserService" options="-parameters" /> <module name="UserService" options="-parameters" />
......
...@@ -3,18 +3,95 @@ ...@@ -3,18 +3,95 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>MicroServices</artifactId> <groupId>org.springframework.boot</groupId>
<groupId>org.example</groupId> <artifactId>spring-boot-starter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>3.0.1</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>CloudGateway</artifactId> <artifactId>CloudGateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>CloudGateway</name>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>17</java.version>
<spring-cloud.version>2022.0.0</spring-cloud.version>
</properties> </properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>netflix-candidates</id>
<name>Netflix Candidates</name>
<url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project> </project>
\ No newline at end of file
package org.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class CloudGatewayApplication {
public static void main(String[] args) {
SpringApplication.run(CloudGatewayApplication.class, args);
}
}
\ No newline at end of file
package org.example;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
\ No newline at end of file
server:
port: 9090
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: DataBase
uri: lb://database-service
predicates:
- Path=/users-db/**
- Path=/flights-db/**
- id: UserService
uri: lb://user-service
predicates:
- Path=/users/**
- id: WeatherService
uri: lb://weather-service
predicates:
- Path=/weather/**
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
default-zone: http://localhost:8761/eureka/
# instance:
# hostname: localhost
# preferIpAddress: true
\ No newline at end of file
server:
port: 9090
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: DataBase
uri: lb://database-service
predicates:
- Path=/users-db/**
- Path=/flights-db/**
- id: UserService
uri: lb://user-service
predicates:
- Path=/users/**
- id: WeatherService
uri: lb://weather-service
predicates:
- Path=/weather/**
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
default-zone: http://localhost:8761/eureka/
# instance:
# hostname: localhost
# preferIpAddress: true
\ No newline at end of file
...@@ -16,7 +16,6 @@ public class WeatherServiceApp ...@@ -16,7 +16,6 @@ public class WeatherServiceApp
SpringApplication.run(WeatherServiceApp.class, args); SpringApplication.run(WeatherServiceApp.class, args);
} }
//@LoadBalanced
@Bean @Bean
@LoadBalanced @LoadBalanced
public RestTemplate getRestTemplate() public RestTemplate getRestTemplate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment