Skip to content

Handle missing gRPC server event type in test initializer#50826

Open
xfocus3 wants to merge 3 commits into
spring-projects:mainfrom
xfocus3:gh-50825-grpc-test-classic-listener
Open

Handle missing gRPC server event type in test initializer#50826
xfocus3 wants to merge 3 commits into
spring-projects:mainfrom
xfocus3:gh-50825-grpc-test-classic-listener

Conversation

@xfocus3

@xfocus3 xfocus3 commented Jun 23, 2026

Copy link
Copy Markdown

Closes gh-50825

spring-boot-starter-test-classic can include spring-boot-grpc-test without the Spring gRPC server classes. The gRPC test initializer currently adds a listener whose generic event type references GrpcServerStartedEvent; refreshing any context then asks Spring to resolve the listener event type and fails when that class is not on the classpath.

This changes the listener to accept application events and only handle gRPC server-started events by class name. It keeps the existing port-property behavior when Spring gRPC is present and avoids resolving the event type when it is absent.

Verification:

  • RED: GrpcPortInfoApplicationContextInitializerTests.whenGrpcServerStartedEventIsNotPresentInitializerDoesNotFailOnRefresh failed before the fix with TypeNotPresentException: Type org.springframework.grpc.server.lifecycle.GrpcServerStartedEvent not present
  • ./gradlew --no-daemon :module:spring-boot-grpc-test:test --tests org.springframework.boot.grpc.test.autoconfigure.GrpcPortInfoApplicationContextInitializerTests
  • ./gradlew --no-daemon :module:spring-boot-grpc-test:test :module:spring-boot-grpc-test:checkstyleMain :module:spring-boot-grpc-test:checkstyleTest
  • git diff --check HEAD

Signed-off-by: Ahmed El amraouiyine <amraouiyine@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 23, 2026
Ahmed El amraouiyine added 2 commits June 23, 2026 18:43
Signed-off-by: Ahmed El amraouiyine <amraouiyine@gmail.com>
Signed-off-by: Ahmed El amraouiyine <amraouiyine@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.1.0 Upgrade from 4.0.0 results in "TypeNotPresentException: ... GrpcServerStartedEvent"

2 participants