-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Task 19 : Revise ProductserviceApplication and Define GatewayConfig w…
…ith its Java Doc
- Loading branch information
1 parent
26178bc
commit ce3d9c2
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
apigateway/src/main/java/com/springbootmicroservices/apigateway/config/GatewayConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.springbootmicroservices.apigateway.config; | ||
|
||
import org.springframework.cloud.gateway.route.RouteLocator; | ||
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* Configuration class named {@link GatewayConfig} for setting up API Gateway routes. | ||
*/ | ||
@Configuration | ||
public class GatewayConfig { | ||
|
||
/** | ||
* Configures the route locator to define the routing rules for the gateway. | ||
* | ||
* @param builder The RouteLocatorBuilder used to build the RouteLocator. | ||
* @return A RouteLocator with the defined routes. | ||
*/ | ||
@Bean | ||
public RouteLocator routes(RouteLocatorBuilder builder) { | ||
|
||
return builder.routes() | ||
.route("productservice", r -> r.path("/api/v1/products/**") | ||
.uri("lb://productservice")) | ||
.build(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters