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.
Could you please add a comment about the why?
| 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.
Is the addition of an interface really needed?
There was a problem hiding this comment.
Should the comment specify that the class is for internal use?
There was a problem hiding this comment.
The interface name should perhaps mentioned that this interface is only for post processor usage. OpentTelemerySupplierInPostProcessor?
There was a problem hiding this comment.
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.
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
OpenTelemetryinject aSupplierto avoid having a direct dependency onOpenTelemetrybean and its dependencies.