You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented exception handling class and annotated it with @GrpcAdvice annotation. In another library it is declared an aspect for all methods annotated by @GrpcExceptionHandler annotation, but the aspect is not get applied because there is no way to initialize another configuration before net.devh.boot.grpc.server.autoconfigure.GrpcAdviceAutoConfiguration.
Source of the issue is the way how GrpcAdviceIsPresentCondition is implemented:
public boolean matches(final ConditionContext context, final AnnotatedTypeMetadata metadata) {
final ConfigurableListableBeanFactory safeBeanFactory =
requireNonNull(context.getBeanFactory(), "ConfigurableListableBeanFactory is null");
return !safeBeanFactory.getBeansWithAnnotation(GrpcAdvice.class).isEmpty();
}
call of the method getBeansWithAnnotation() forces initialization of GrpcAdviceAutoConfiguration on bean definitions loading stage and disregards any declared priority.
The fix for the issue would be a usage of getBeanNamesForAnnotation() instead of getBeansWithAnnotation()
Steps to Reproduce
Try to define an aspect for @GrpcExceptionHandler annotated methods. The aspect will not be applied to target.
The application's environment
Which versions do you use?
Spring (boot): 2.3.5.RELEASE
grpc-java: 1.35.0
grpc-spring-boot-starter: 2.11.0.RELEASE
java: version + architecture (64bit?) java15
Other relevant libraries...
Additional context
Did it ever work before? - no
Do you have a demo? - no
The text was updated successfully, but these errors were encountered:
I've implemented exception handling class and annotated it with @GrpcAdvice annotation. In another library it is declared an aspect for all methods annotated by @GrpcExceptionHandler annotation, but the aspect is not get applied because there is no way to initialize another configuration before net.devh.boot.grpc.server.autoconfigure.GrpcAdviceAutoConfiguration.
Source of the issue is the way how GrpcAdviceIsPresentCondition is implemented:
public boolean matches(final ConditionContext context, final AnnotatedTypeMetadata metadata) {
final ConfigurableListableBeanFactory safeBeanFactory =
requireNonNull(context.getBeanFactory(), "ConfigurableListableBeanFactory is null");
return !safeBeanFactory.getBeansWithAnnotation(GrpcAdvice.class).isEmpty();
}
call of the method getBeansWithAnnotation() forces initialization of GrpcAdviceAutoConfiguration on bean definitions loading stage and disregards any declared priority.
The fix for the issue would be a usage of getBeanNamesForAnnotation() instead of getBeansWithAnnotation()
Steps to Reproduce
Try to define an aspect for @GrpcExceptionHandler annotated methods. The aspect will not be applied to target.
The application's environment
Which versions do you use?
Additional context
The text was updated successfully, but these errors were encountered: