Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to spring boot 3.4.0 and polish #1566

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Upgrade to spring boot 3.4.0 and polish #1566

merged 1 commit into from
Dec 12, 2024

Conversation

rajadilipkolli
Copy link
Owner

@rajadilipkolli rajadilipkolli commented Dec 12, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new entry point for the application with TestTogglzApplication.
  • Improvements

    • Updated dependencies to their latest versions for improved performance and stability.
    • Enhanced test configuration by changing the context initialization class.
  • Bug Fixes

    • Adjusted test behavior for customer retrieval to ensure correct ID assignment.
  • Refactor

    • Renamed the main application class to TogglzApplication for clarity.
    • Updated mock creation in tests to utilize @MockitoBean for better integration.

Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Walkthrough

The changes in this pull request primarily involve updates to the pom.xml file for the boot-togglz-sample project, including version upgrades for dependencies and plugins. Notably, the Spring Boot parent version was updated from 3.3.6 to 3.4.0, and other dependencies like springdoc-openapi and googleJavaFormat were also upgraded. Additionally, there were modifications to several Java classes, including renaming the main application class and altering test configurations, but no changes were made to the core logic or control flow.

Changes

File Path Change Summary
boot-togglz-sample/pom.xml Updated Spring Boot version from 3.3.6 to 3.4.0, springdoc-openapi from 2.6.0 to 2.7.0, and googleJavaFormat from 1.22.0 to 1.25.0.
boot-togglz-sample/src/main/java/com/example/featuretoggle/TogglzApplication.java Renamed class from Application to TogglzApplication.
boot-togglz-sample/src/test/java/com/example/featuretoggle/ApplicationIntegrationTest.java Modified shouldFindCustomerByIdWithEmptyData test method to set Customer id to null.
boot-togglz-sample/src/test/java/com/example/featuretoggle/TestTogglzApplication.java Added new class TestTogglzApplication with a main method for application initialization.
boot-togglz-sample/src/test/java/com/example/featuretoggle/common/AbstractIntegrationTest.java Updated @SpringBootTest annotation to use ContainerConfig.class.
boot-togglz-sample/src/test/java/com/example/featuretoggle/common/ContainerConfig.java Changed class name from TestApplication to ContainerConfig, updated Docker image version from mysql:9.0 to mysql:9.1, and removed the main method.
boot-togglz-sample/src/test/java/com/example/featuretoggle/web/controllers/CustomerControllerTest.java Replaced @MockBean with @MockitoBean for customerService.

Possibly related PRs

Suggested labels

type: dependency-upgrade

Poem

🐰 In the garden of code, we hop with glee,
Upgrading dependencies, as happy as can be!
From Spring Boot's embrace, we take a new flight,
With Togglz shining bright, our future's so right!
Let's test and let's play, in this code we trust,
For every little change, brings joy and must! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.

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 docstrings to generate docstrings for this PR. (Experiment)
  • @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.

@github-actions github-actions bot added type: dependency-upgrade Pull requests that update a dependency file component: togglz labels Dec 12, 2024
@rajadilipkolli rajadilipkolli self-assigned this Dec 12, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
boot-togglz-sample/pom.xml (1)

Line range hint 351-365: Consider removing milestone repositories

Since we're using stable versions of Spring Boot and dependencies, the milestone repositories might not be necessary. Consider removing them unless you're planning to use milestone versions in the future.

Also applies to: 366-380

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 96d6c3d and 0f55f7a.

📒 Files selected for processing (7)
  • boot-togglz-sample/pom.xml (3 hunks)
  • boot-togglz-sample/src/main/java/com/example/featuretoggle/TogglzApplication.java (1 hunks)
  • boot-togglz-sample/src/test/java/com/example/featuretoggle/ApplicationIntegrationTest.java (1 hunks)
  • boot-togglz-sample/src/test/java/com/example/featuretoggle/TestTogglzApplication.java (1 hunks)
  • boot-togglz-sample/src/test/java/com/example/featuretoggle/common/AbstractIntegrationTest.java (1 hunks)
  • boot-togglz-sample/src/test/java/com/example/featuretoggle/common/ContainerConfig.java (2 hunks)
  • boot-togglz-sample/src/test/java/com/example/featuretoggle/web/controllers/CustomerControllerTest.java (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • boot-togglz-sample/src/main/java/com/example/featuretoggle/TogglzApplication.java
🔇 Additional comments (7)
boot-togglz-sample/src/test/java/com/example/featuretoggle/TestTogglzApplication.java (1)

8-10: Well-structured test application setup!

The implementation follows Spring Boot 3.x best practices by using SpringApplication.from() pattern for test configuration.

boot-togglz-sample/src/test/java/com/example/featuretoggle/common/ContainerConfig.java (1)

10-18: Well-structured test container configuration!

The configuration follows Spring Boot 3.x best practices:

  • Proper use of @TestConfiguration(proxyBeanMethods = false)
  • Correct usage of @ServiceConnection for container management
  • Good use of @RestartScope for container lifecycle
boot-togglz-sample/src/test/java/com/example/featuretoggle/common/AbstractIntegrationTest.java (1)

14-14: Well-structured integration test configuration!

The test configuration follows Spring Boot 3.x best practices:

  • Proper use of separate configuration class
  • Correct setup of test environment with RANDOM_PORT
  • Good integration with test containers through ContainerConfig
boot-togglz-sample/src/test/java/com/example/featuretoggle/ApplicationIntegrationTest.java (1)

25-25: LGTM! Improved entity creation pattern

Using null for the ID field during entity creation is the correct approach, allowing the persistence layer to handle ID generation.

boot-togglz-sample/pom.xml (3)

22-22: LGTM! springdoc-openapi version upgrade

The upgrade to springdoc-openapi 2.7.0 is compatible with Spring Boot 3.4.0.


237-237: LGTM! Updated Google Java Format

The upgrade to Google Java Format 1.25.0 is a maintenance update that includes the latest style improvements.


8-8: Verify Spring Boot 3.4.0 compatibility

The upgrade to Spring Boot 3.4.0 is significant. Let's verify the compatibility of custom configurations and beans with the new version.

✅ Verification successful

Let me analyze the configurations found and gather more information about Spring Boot specific annotations and beans.

The first search revealed several configuration classes but we need to check for Spring Boot specific components and custom properties to ensure compatibility. This will help us verify if there are any deprecated or changed configurations in Spring Boot 3.4.0.


Based on the analysis of the Spring Boot applications and their configurations, I can now provide a final response regarding the Spring Boot 3.4.0 upgrade:

Spring Boot 3.4.0 upgrade appears compatible with existing configurations

The codebase shows standard Spring Boot usage patterns that are stable across 3.x versions:

  • Standard @SpringBootApplication and @Configuration annotations usage
  • Common Spring Boot patterns for beans and configurations
  • No deprecated or removed Spring Boot 3.x features in use
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential compatibility issues in custom configurations
ast-grep --pattern 'class $_ implements WebMvcConfigurer { $$$  }'
ast-grep --pattern '@Configuration class $_ { $$$ }'

Length of output: 9609


Script:

#!/bin/bash
# Search for Spring Boot specific annotations and configurations
ast-grep --pattern '@SpringBootApplication class $_ { $$$ }'
ast-grep --pattern '@EnableAutoConfiguration class $_ { $$$ }'
ast-grep --pattern '@Bean $_ $_($$$) { $$$ }'

# Search for custom property configurations
rg "@ConfigurationProperties" -A 2

Length of output: 67007


public static void main(String[] args) {
SpringApplication.from(Application::main).with(TestApplication.class).run(args);
return new MySQLContainer<>(DockerImageName.parse("mysql:9.1"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix invalid MySQL version

The specified MySQL version 9.1 doesn't exist. The latest GA version of MySQL is in the 8.x series.

Please update to a valid MySQL version:

-        return new MySQLContainer<>(DockerImageName.parse("mysql:9.1"));
+        return new MySQLContainer<>(DockerImageName.parse("mysql:8.2"));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return new MySQLContainer<>(DockerImageName.parse("mysql:9.1"));
return new MySQLContainer<>(DockerImageName.parse("mysql:8.2"));

import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Multiple test files still use @MockBean and should be updated to @MockitoBean

The search results show several test files across different modules still using @MockBean. Since this is a Spring Boot 3.4.0 best practice update, these should also be migrated to @MockitoBean for consistency. Here are the files that need attention:

  • scheduler/boot-scheduler-shedlock/src/test/java/com/learning/shedlock/web/controllers/JobControllerTest.java
  • jpa/multitenancy/partition/src/test/java/com/example/multitenancy/partition/web/controllers/CustomerControllerTest.java
  • jpa/multitenancy/schema/src/test/java/com/example/multitenancy/schema/web/controllers/CustomerControllerTest.java
  • jpa/boot-jndi-sample/src/test/java/com/example/jndi/web/controllers/DriverControllerTest.java
  • And several others in the graphql, r2dbc, and httpClients modules
🔗 Analysis chain

LGTM! Updated to use @MockitoBean

The change from @MockBean to @MockitoBean aligns with Spring Boot 3.4.0 best practices. However, let's verify there are no other instances of @MockBean that should be updated.

Also applies to: 39-39

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining @MockBean annotations that might need updating
rg "@MockBean" --type java

Length of output: 5101

@rajadilipkolli rajadilipkolli merged commit d45cc4c into main Dec 12, 2024
8 checks passed
@rajadilipkolli rajadilipkolli deleted the sb34-toggle branch December 12, 2024 12:04
Copy link
Contributor

Qodana Community for JVM

105 new problems were found

Inspection name Severity Problems
Usage of API marked for removal 🔴 Failure 2
@NotNull/@Nullable problems 🔶 Warning 38
Unchecked warning 🔶 Warning 32
'equals()' method which does not check class of parameter 🔶 Warning 21
Nullability and data flow problems 🔶 Warning 3
Declaration has problems in Javadoc references 🔶 Warning 2
AutoCloseable used without 'try'-with-resources 🔶 Warning 1
Class is exposed outside of its visibility scope 🔶 Warning 1
Field can be local 🔶 Warning 1
Javadoc declaration problems 🔶 Warning 1
Mismatched query and update of collection 🔶 Warning 1
Optional.get() is called without isPresent() check 🔶 Warning 1
Commented out code ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: togglz type: dependency-upgrade Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant