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

Add @ConditionalOnMissingBean to grpcRequestScope for clarity and configurability #1168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yizhao1998
Copy link

This PR adds the @ConditionalOnMissingBean annotation to the grpcRequestScope bean definition in GrpcServerAutoConfiguration.

Why this change?

  • GrpcRequestScope is already annotated with @Component, meaning it can be registered through component scanning
  • While Spring does not register duplicate beans by default, adding @ConditionalOnMissingBean makes it explicit that this bean is only created if no other GrpcRequestScope instance exists.
  • This improves code clarity and aligns with Spring Boot's best practices for auto-configuration.
  • It ensures better compatibility in cases where GrpcRequestScope might be customized, proxied, or overridden in user applications.

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.

1 participant