sample-message-driven-microservices icon indicating copy to clipboard operation
sample-message-driven-microservices copied to clipboard

Update dependency org.springframework.cloud:spring-cloud-dependencies to v2024

Open renovate[bot] opened this issue 1 year ago • 1 comments

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
org.springframework.cloud:spring-cloud-dependencies (source) 2023.0.1 -> 2024.0.1 age adoption passing confidence

[!WARNING] Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

spring-cloud/spring-cloud-release (org.springframework.cloud:spring-cloud-dependencies)

v2024.0.1

v2024.0.0: 2024.0.0

What's Changed
New Contributors

Full Changelog: https://github.com/spring-cloud/spring-cloud-release/compare/v2023.0.3...v2024.0.0

v2023.0.5

v2023.0.4: 2023.0.4

Full Changelog: https://github.com/spring-cloud/spring-cloud-release/compare/v2023.0.3...v2023.0.4

v2023.0.3

Full Changelog: https://github.com/spring-cloud/spring-cloud-release/compare/v2023.0.2...v2023.0.3

Module Version Issues
Spring Cloud Vault 4.1.3
Spring Cloud Bus 4.1.2
Spring Cloud Zookeeper 4.1.2
Spring Cloud Kubernetes 3.1.3 (issues)
Spring Cloud Task 3.1.2 (issues)
Spring Cloud Function 4.1.3 (issues)
Spring Cloud Commons 4.1.4 (issues)
Spring Cloud OpenFeign 4.1.3 (issues)
Spring Cloud CircuitBreaker 3.1.2 (issues)
Spring Cloud Starter Build 2023.0.3
Spring Cloud Stream 4.1.3
Spring Cloud Gateway 4.1.5 (issues)
Spring Cloud Consul 4.1.2
Spring Cloud Contract 4.1.4 (issues)
Spring Cloud Config 4.1.3 (issues)
Spring Cloud Build 4.1.3
Spring Cloud Netflix 4.1.3 (issues)

v2023.0.2

Module Version Issues
Spring Cloud Vault 4.1.2 (issues)
Spring Cloud Kubernetes 3.1.2 (issues)
Spring Cloud Function 4.1.2 (issues)
Spring Cloud Commons 4.1.3 (issues)
Spring Cloud Openfeign 4.1.2 (issues)
Spring Cloud Starter Build 2023.0.2 (issues)
Spring Cloud Stream 4.1.2 (issues)
Spring Cloud Gateway 4.1.4 (issues)
Spring Cloud Contract 4.1.3 (issues)
Spring Cloud Config 4.1.2 (issues)
Spring Cloud Build 4.1.2 (issues)
Spring Cloud Netflix 4.1.2 (issues)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

renovate[bot] avatar Dec 03 '24 08:12 renovate[bot]

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

renovate[bot] avatar Mar 20 '25 22:03 renovate[bot]

Walkthrough

The updates introduce RabbitMQ integration and Testcontainers support, update tracing dependencies from OpenTelemetry to Brave, and add Reactor Micrometer instrumentation across services. Build configurations are modernized with newer Spring Boot and Spring Cloud versions, and CircleCI is adjusted for improved compatibility. Test classes are enhanced for better message channel and containerized testing.

Changes

File(s) Change Summary
.circleci/config.yml Switched executor from Docker-based JDK to machine executor (Ubuntu 22.04 AMD64), and updated Maven SonarCloud analysis to skip tests.
docker-compose.yml Added a new Docker Compose file defining a RabbitMQ service using the rabbitmq:4 image, exposing port 5672.
pom.xml Updated Spring Boot (3.3.5 → 3.4.3), Spring Cloud BOM (2023.0.1 → 2024.0.1), added Testcontainers BOM management, and introduced testcontainers.version property.
account-service/pom.xml
product-service/pom.xml
Replaced micrometer-tracing-bridge-otel with micrometer-tracing-bridge-brave, and added reactor-core-micrometer dependency.
order-service/pom.xml Added Spring Cloud Stream Rabbit starter, switched tracing bridge to Brave, added Reactor Micrometer, and included Testcontainers dependencies for RabbitMQ and JUnit integration.
account-service/src/test/java/pl/piomin/services/account/OrderReceiverTest.java
product-service/src/test/java/pl/piomin/services/product/OrderReceiverTest.java
Added @EnableTestBinder annotation to test classes to enable in-memory message channel testing.
order-service/src/test/java/pl/piomin/services/order/OrderControllerTest.java Integrated Testcontainers for RabbitMQ: added @Testcontainers annotation, static RabbitMQ container field with @Container and @ServiceConnection, enabling containerized RabbitMQ for tests.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Class
    participant Testcontainers as Testcontainers
    participant RabbitMQ as RabbitMQ Container

    Test->>Testcontainers: Start test execution
    Testcontainers->>RabbitMQ: Launch RabbitMQ container (rabbitmq:4)
    RabbitMQ-->>Testcontainers: Expose port 5672
    Testcontainers-->>Test: Provide service connection details
    Test->>RabbitMQ: Execute messaging tests
    Test-->>Testcontainers: Complete test, stop container
sequenceDiagram
    participant Service as Service (Account/Product/Order)
    participant Micrometer as Micrometer
    participant Brave as Brave Tracing
    participant Reactor as Reactor Core

    Service->>Micrometer: Collect metrics
    Micrometer->>Brave: Bridge tracing data
    Service->>Reactor: Reactive operations
    Reactor->>Micrometer: Report reactor metrics

Poem

🐇
With RabbitMQ now in a Docker den,
And tracing Brave, not OTel, again,
Testcontainers hop in to lend a hand,
While CircleCI runs just as planned.
Metrics and messages flow with glee—
A modern warren for code, you see!
🌱

[!TIP]

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between ed03cd6ba227842e018330cfb51597c75f353e4d and c9d784b71a4552f2eef5caf63643943bff12d7cd.

📒 Files selected for processing (9)
  • .circleci/config.yml (2 hunks)
  • account-service/pom.xml (1 hunks)
  • account-service/src/test/java/pl/piomin/services/account/OrderReceiverTest.java (2 hunks)
  • docker-compose.yml (1 hunks)
  • order-service/pom.xml (3 hunks)
  • order-service/src/test/java/pl/piomin/services/order/OrderControllerTest.java (2 hunks)
  • pom.xml (3 hunks)
  • product-service/pom.xml (1 hunks)
  • product-service/src/test/java/pl/piomin/services/product/OrderReceiverTest.java (2 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 11 '25 22:05 coderabbitai[bot]

@coderabbitai review

piomin avatar May 11 '25 22:05 piomin

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar May 11 '25 22:05 coderabbitai[bot]

@coderabbitai fullreview

piomin avatar May 11 '25 22:05 piomin

[!TIP] For best results, initiate chat on the files or code changes.

@piomin I've triggered a full review of your PR. This will review all files from scratch, ignoring any previous review comments or feedback. The review results will be available shortly.

✅ Actions performed

Full review triggered.

Note: A full review analyzes all files in the PR from scratch, disregarding previous review comments. This is useful when you want a comprehensive review of the entire PR.

coderabbitai[bot] avatar May 11 '25 22:05 coderabbitai[bot]

@coderabbitai plan

piomin avatar May 11 '25 22:05 piomin

A summary of the edits CodeRabbit can apply:

We will introduce Maven dependency caching by wrapping the SonarCloud analysis step with the circleci/maven orb’s with_cache command in .circleci/config.yml.

We will enhance docker-compose.yml to enable RabbitMQ management UI, add data persistence, default credentials, and a healthcheck.

We will introduce version properties for Spring Cloud and Micrometer BOMs in account-service/pom.xml.

We will import the Spring Cloud and Micrometer BOMs via a dependencyManagement section in account-service/pom.xml.

We will update product-service/pom.xml to import the Spring Cloud BOM, declare the spring-cloud.version matching the version used by order-service, remove explicit versions for Spring-managed dependencies, and align the Spring Boot plugin version with sibling modules.

We will add centralized plugin version properties to pom.xml for consistent plugin management.

We will insert a <pluginManagement> block into the <build> section of pom.xml to configure common plugins for all modules.

We will enhance OrderReceiverTest.java by adding parameterized and edge‐case tests to fully cover OrderReceiver’s business logic (threshold boundary, null payload, malformed JSON, empty and multiple product lists) and ensure robust error handling.

Will add imports for DynamicPropertyRegistry and DynamicPropertySource to OrderControllerTest.java.

Will add a DynamicPropertySource method to register the RabbitMQ container’s host and port as Spring properties in OrderControllerTest.java.

We will update messaging-common/pom.xml to add module metadata, standard properties, and plugin management for compilation and testing, noting that no external dependencies are required.

A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets):

✏️ .circleci/config.yml

Replace lines 7–11 in .circleci/config.yml with the following block to leverage the orb’s built-in caching:

    steps:
      - checkout
      - maven/with_cache:
          steps:
            - run:
                name: Analyze on SonarCloud
                command: mvn verify sonar:sonar -DskipTests
✏️ docker-compose.yml

Replace the image line under the rabbitmq service. Change

image: rabbitmq:4

to

image: rabbitmq:management

so that the management plugin is available.


Under the rabbitmq service, add an environment section to set default credentials. For example:

environment:
  RABBITMQ_DEFAULT_USER: "${RABBITMQ_DEFAULT_USER:-guest}"
  RABBITMQ_DEFAULT_PASS: "${RABBITMQ_DEFAULT_PASS:-guest}"

This ensures you can override the user and password via environment variables.


Add a new ports mapping to expose the management UI. In the ports list, append:

- "15672:15672"

so that you can access the RabbitMQ management console on port 15672.


Add a named volume to persist broker data. Under the rabbitmq service, insert:

volumes:
  - rabbitmq_data:/var/lib/rabbitmq

And at the bottom of the file, declare the volume:

volumes:
  rabbitmq_data:

so that messages and metadata survive container restarts.


Add a healthcheck to monitor container health. Under the rabbitmq service, insert:

healthcheck:
  test: ["CMD-SHELL", "rabbitmqctl status"]
  interval: 30s
  timeout: 10s
  retries: 5

to ensure Docker Compose restarts unhealthy instances automatically.


Optionally, define a dedicated network for RabbitMQ. At the bottom of the file, add:

networks:
  rabbitnet:

And under the rabbitmq service, reference it:

networks:
  - rabbitnet

to isolate messaging traffic if you add other services later.


Save and apply the updated docker-compose.yml. Run docker-compose up -d and verify:
– The management UI is reachable at http://localhost:15672
– Data persists across restarts
– The healthcheck is passing

✏️ account-service/pom.xml

Insert the following property definitions immediately after the <sonar.moduleKey> element to parameterize the BOM versions:

    <!-- BOM version properties -->
    <spring-cloud.version>INSERT_SPRING_CLOUD_DEPENDENCIES_BOM_VERSION</spring-cloud.version>
    <micrometer.version>INSERT_MICROMETER_BOM_VERSION</micrometer.version>

Ensure that you replace INSERT_SPRING_CLOUD_DEPENDENCIES_BOM_VERSION and INSERT_MICROMETER_BOM_VERSION with the actual versions used by your organization or defined in your parent BOM.

✏️ pom.xml

Locate the section (around lines 9–15). Immediately after the <sonar.host.url> entry, add these properties to declare versions for common Maven plugins:

    <enforcer.plugin.version>3.1.1</enforcer.plugin.version>
    <versions.plugin.version>2.14.1</versions.plugin.version>
    <sonar.maven.plugin.version>3.9.1.2184</sonar.maven.plugin.version>
    <dockerfile.maven.plugin.version>1.4.13</dockerfile.maven.plugin.version>

Ensure each new <property> aligns with existing entries and is properly indented within the <properties> block.

✏️ account-service/src/test/java/pl/piomin/services/account/OrderReceiverTest.java

After identifying the implementation file and threshold logic, confirm there is a public static final long THRESHOLD in that class. If missing or private, refactor the numeric literal into a public constant so tests can reference OrderReceiver.THRESHOLD directly.


Add these imports at the top of OrderReceiverTest.java for parameterized testing:

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

Add a parameterized test method that sends an order priced at the threshold:

@ParameterizedTest
@ValueSource(longs = { OrderReceiver.THRESHOLD })
public void testAtThreshold(long price) throws JsonProcessingException {
    Order o = new Order();
    o.setId(2L);
    o.setAccountId(1L);
    o.setCustomerId(1L);
    o.setPrice(price);
    o.setProductIds(Collections.singletonList(3L));
    input.send(MessageBuilder.withPayload(o).build());
    Message<byte[]> received = output.receive();
    assertNotNull(received);
    Order result = mapper.readValue(received.getPayload(), Order.class);
    // Expect ACCEPTED at the threshold
    assertEquals(OrderStatus.ACCEPTED, result.getStatus());
}

Add a test for a null-payload message to verify that no output is produced:

@Test
public void testNullPayload() {
    input.send(MessageBuilder.withPayload((Order) null).build());
    Message<byte[]> received = output.receive();
    assertNull(received);
}

Add a test for malformed JSON input to ensure errors are suppressed:

@Test
public void testInvalidJson() {
    input.send(MessageBuilder.withPayload("{ bad json }".getBytes()).build());
    Message<byte[]> received = output.receive();
    assertNull(received);
}

Add a test for an empty productIds list and verify ACCEPTED status plus list preservation:

@Test
public void testEmptyProductList() throws JsonProcessingException {
    Order o = new Order();
    o.setId(3L);
    o.setAccountId(1L);
    o.setCustomerId(1L);
    o.setPrice(10);
    o.setProductIds(Collections.emptyList());
    input.send(MessageBuilder.withPayload(o).build());
    Message<byte[]> received = output.receive();
    assertNotNull(received);
    Order result = mapper.readValue(received.getPayload(), Order.class);
    assertEquals(OrderStatus.ACCEPTED, result.getStatus());
    assertTrue(result.getProductIds().isEmpty());
}

Add a test for multiple productIds to verify they are preserved and the status remains ACCEPTED:

@Test
public void testMultipleProductIds() throws JsonProcessingException {
    Order o = new Order();
    o.setId(4L);
    o.setAccountId(1L);
    o.setCustomerId(1L);
    o.setPrice(20);
    o.setProductIds(Arrays.asList(1L, 2L, 3L));
    input.send(MessageBuilder.withPayload(o).build());
    Message<byte[]> received = output.receive();
    assertNotNull(received);
    Order result = mapper.readValue(received.getPayload(), Order.class);
    assertEquals(3, result.getProductIds().size());
    assertEquals(OrderStatus.ACCEPTED, result.getStatus());
}

Run the full suite (mvn test) to ensure that all existing and new tests pass, providing comprehensive coverage of OrderReceiver’s acceptance, rejection, and error-handling behavior.

✏️ order-service/src/test/java/pl/piomin/services/order/OrderControllerTest.java

Immediately after the existing import block (around line 19), insert:

import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;

This brings in Spring’s dynamic property registry support.

A summary of the context that CodeRabbit is considering across the codebase:

We inspected each submodule’s pom.xml to confirm they don’t declare their own plugin versions or pluginManagement, ensuring a centralized configuration in the root POM will be consistently applied.

List all Java implementation files under account-service to identify the class that contains the OrderReceiver logic (it may have a different name).

Once we know the candidate implementation file(s), inspect the first 200 lines of each to identify the receiver class name, any threshold constants, and input/output binding names.

If no public threshold constant is declared in the implementation, search for numeric comparisons on order price to infer the threshold and plan to refactor it into a public constant.

Search for any static final field named THRESHOLD (or similar) in the codebase, to locate an existing threshold declaration.

We need to inspect the OrderSender messaging interface to determine its output binding name and configuration so our test harness’s OutputDestination will capture the processed Order correctly.

The only imports in messaging-common’s Java sources are java.util.List and core JDK types; there are no third‐party libraries to declare as dependencies.

  • [ ] ✅ Create PR with these edits

  • [ ] 📌 Create commit in current branch

  • [ ] 📋 Get copyable edits

coderabbitai[bot] avatar May 11 '25 22:05 coderabbitai[bot]