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

Buggy interceptors @Order annotation processing #379

Closed
debraj-manna opened this issue Sep 22, 2023 · 5 comments
Closed

Buggy interceptors @Order annotation processing #379

debraj-manna opened this issue Sep 22, 2023 · 5 comments
Labels
bug Auto-generates notes
Milestone

Comments

@debraj-manna
Copy link

We have a spring boot application that uses ServerInterceptors The problem I found is that if the @order annotation is added to the @bean definition it won't have any effect.

@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
@GRpcGlobalInterceptor
public io.grpc.ServerInterceptor globalServerMicrometerInterceptor(
      final ObservationRegistry observationRegistry) {
    // for metric collection and distributed tracing
    return new ObservationGrpcServerInterceptor(observationRegistry);
}

And then another one

@Bean
@GRpcGlobalInterceptor
public io.grpc.ServerInterceptor globalServerInterceptor(...) {
...
}

But the second one is not running later than the first one. Can someone let me know how can I enforce this?

<grpc.springboot.starter.version>5.1.2</grpc.springboot.starter.version>
<spring-boot.version>3.0.11</spring-boot.version>
@debraj-manna
Copy link
Author

The same has been fixed in https://github.com/yidongnan/grpc-spring-boot-starter/issues/627

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 24, 2023

As a quick work around you can have the interceptors you return to implement Ordered

@jvmlet jvmlet added this to the 5.1.5 milestone Sep 27, 2023
@jvmlet jvmlet closed this as completed in 4c0f536 Sep 27, 2023
@jvmlet jvmlet added enhancement Auto-generates notes bug Auto-generates notes and removed enhancement Auto-generates notes labels Sep 27, 2023
@jvmlet jvmlet changed the title Allow order Interceptors by using @Order annotation in the @Bean definition Buggy interceptors @Order annotation processing Sep 27, 2023
@debraj-manna
Copy link
Author

@jvmlet We are using spring-boot 3.0.11. Fix is made in 5.1.5. Do I have to upgrade spring-boot also to 3.1.1 (as per the version matrix) or I can use 5.1.5 with my current spring-boot 3.0.11?

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 27, 2023

3.0.11 should be fine, release build is on the way ....

@jvmlet
Copy link
Collaborator

jvmlet commented Sep 27, 2023

5.1.5 was released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Auto-generates notes
Projects
None yet
Development

No branches or pull requests

2 participants