-
Notifications
You must be signed in to change notification settings - Fork 873
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
Fix warnings from the spring boot starter #10086
Conversation
|
||
@Bean | ||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE) | ||
public static OpenTelemetrySupplier openTelemetrySupplier(BeanFactory beanFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a comment about the why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added
import java.util.function.Supplier; | ||
|
||
/** To inject an OpenTelemetry into bean post processors */ | ||
public interface OpenTelemetrySupplier extends Supplier<OpenTelemetry> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the addition of an interface really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the comment specify that the class is for internal use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface name should perhaps mentioned that this interface is only for post processor usage. OpentTelemerySupplierInPostProcessor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to internal package, but left the name as is.
Is the addition of an interface really needed?
Do you have a better idea how to do this? To me using a separate interface felt like the simplest approach to ensure that there is only 1 bean that matches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. By declaring a bean of type Supplier<OpenTelemetry>
, the user could also declare in his code this type of bean and the application will fail to start.
1b7cf46
to
c70e2f7
Compare
Resolves #9988
As far as I understand these warnings are printed for beans that are dependencies for one of our BeanPostProcessors. This pr attempts to resolve this be declaring the methods that return a BeanPostProcessor as static to avoid having dependency on the bean that contains the method and instead of
OpenTelemetry
inject aSupplier
to avoid having a direct dependency onOpenTelemetry
bean and its dependencies.