Skip to content

Conversation

@osoykan
Copy link
Collaborator

@osoykan osoykan commented Nov 21, 2025

fixes #480

Copilot AI review requested due to automatic review settings November 21, 2025 11:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Spring Boot 4.x by creating a new kediatr-spring-boot-4x-starter module, following the same pattern as existing Spring Boot 2x and 3x starters. The implementation mirrors the Spring Boot 3x starter structure with autoconfiguration support.

  • Created a new Spring Boot 4x starter module with autoconfiguration
  • Updated project settings to include the new starter module
  • Removed unused autoconfigure dependency from Spring Boot 3x starter

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
settings.gradle.kts Added the new kediatr-spring-boot-4x-starter module to the project
gradle/libs.versions.toml Added Spring Boot 4.0.0 version and related dependency declarations
projects/kediatr-spring-boot-4x-starter/build.gradle.kts Created build configuration for the 4x starter module
projects/kediatr-spring-boot-4x-starter/src/main/kotlin/com/trendyol/kediatr/spring/KediatRAutoConfiguration.kt Implemented autoconfiguration for Spring Boot 4x integration
projects/kediatr-spring-boot-4x-starter/src/main/kotlin/com/trendyol/kediatr/spring/KediatRSpringBeanProvider.kt Implemented Spring bean provider for dependency injection
projects/kediatr-spring-boot-4x-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports Registered autoconfiguration for Spring Boot 3+ style discovery
projects/kediatr-spring-boot-4x-starter/src/test/kotlin/com/trendyol/kediatr/spring/MediatorTests.kt Added comprehensive test coverage using shared test cases
projects/kediatr-spring-boot-3x-starter/build.gradle.kts Removed unused autoconfigure dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 11 to 13
override fun <T> getSingleInstanceOf(clazz: Class<T>): T = applicationContext
.getBeanNamesForType(clazz)
.map { applicationContext.getBean(it) as T }
.single()
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

The implementation of getSingleInstanceOf() differs from the Spring Boot 2x and 3x versions, which use the simpler applicationContext.getBean(clazz). This version retrieves bean names, maps them to instances, and calls .single(), which may throw an exception if there are multiple beans of the same type. The 2x/3x approach delegates to Spring's bean resolution logic which properly handles primary beans and qualifiers. Unless there's a specific Spring Boot 4.x compatibility reason for this change, it should be aligned with the existing implementations for consistency.

Suggested change
override fun <T> getSingleInstanceOf(clazz: Class<T>): T = applicationContext
.getBeanNamesForType(clazz)
.map { applicationContext.getBean(it) as T }
.single()
override fun <T> getSingleInstanceOf(clazz: Class<T>): T = applicationContext.getBean(clazz)

Copilot uses AI. Check for mistakes.
@osoykan osoykan merged commit 0fd5db1 into main Nov 21, 2025
5 checks passed
@osoykan osoykan deleted the spring-boot-4x branch November 21, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for spring boot 4

2 participants