Skip to content

Commit

Permalink
Updated dependencies to match what is provided from Spring Initializr (
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmcnees authored May 9, 2024
1 parent 06b58c6 commit d252508
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 30 deletions.
19 changes: 3 additions & 16 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ You will build a gateway using https://cloud.spring.io/spring-cloud-gateway/[Spr

== What You Need

:java_version: 1.8
include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/prereq_editor_jdk_buildtools.adoc[]
* About 15 minutes
* A favorite text editor or IDE
* https://www.oracle.com/java/technologies/downloads/[Java 17+]

include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/how_to_complete_this_guide.adoc[]

Expand Down Expand Up @@ -114,20 +115,6 @@ in circuit breakers. You can do so in the Spring Cloud Gateway by using the Resi
This is implemented through a simple filter that you can add to your requests.
We can create another route to demonstrate this.

To use this filter you need to add the reactive Resilience4J CircuitBreaker dependency to your classpath.

`pom.xml`
[source,java,tabsize=2]
----
include::complete/pom.xml[tags=dependency]
----

`build.gradle`
[source,java,tabsize=2]
----
include::complete/build.gradle[tags=dependency]
----

In the next example, we use HTTPBin's delay API, which waits a certain number of
seconds before sending a response. Since this API could potentially take a long
time to send its response, we can wrap the route that uses this API in a circuit breaker.
Expand Down
4 changes: 1 addition & 3 deletions complete/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ ext {
}

dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j'
// tag::dependency[]
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j'
// end::dependency[]
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
}

Expand Down
13 changes: 6 additions & 7 deletions complete/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
</dependency>
<!-- tag::dependency[] -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
</dependency>
<!-- end::dependency[] -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
Expand All @@ -38,6 +32,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion complete/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
server:
port: 9999
port: 8080
1 change: 0 additions & 1 deletion complete/src/test/java/gateway/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
Expand Down
3 changes: 2 additions & 1 deletion initial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ ext {
}

dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j'
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
}

Expand Down
7 changes: 6 additions & 1 deletion initial/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand All @@ -32,6 +32,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
Expand Down

0 comments on commit d252508

Please sign in to comment.