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

@InterceptorBinding no longer recognized/fired when they have additional fields #5373

Closed
Xnyle opened this issue Nov 11, 2019 · 4 comments · Fixed by #5396
Closed

@InterceptorBinding no longer recognized/fired when they have additional fields #5373

Xnyle opened this issue Nov 11, 2019 · 4 comments · Fixed by #5396
Assignees
Labels
area/arc Issue related to ARC (dependency injection) kind/bug Something isn't working
Milestone

Comments

@Xnyle
Copy link

Xnyle commented Nov 11, 2019

This interceptor binding is working fine, if there is an interceptor (having @priority annotation or not, @AroundInvoke gets fired wherever @StorageThreadSession is annotated):

@Target({TYPE, METHOD})
@Retention(RUNTIME)
@InterceptorBinding
public @interface StorageThreadSession {
}

adding a field to the binding definition, @AroundInvoke stops working, it seems the interceptor binding is not recognized at all in this case:

@Target({TYPE, METHOD})
@Retention(RUNTIME)
@InterceptorBinding
public @interface StorageThreadSession {
	
	Class qualifier() default Object.class;
}

I can split up my annotation but I don't think that this is the desired behaviour.

@Xnyle Xnyle added the kind/bug Something isn't working label Nov 11, 2019
@gwenneg
Copy link
Member

gwenneg commented Nov 11, 2019

Hi @Xnyle! Depending on how you want the interceptor to be activated, you might need to add the @NonBinding annotation to the qualifier member of your interceptor.

If this doesn't help you solve your issue, could you please add more details about your interceptor and intercepted methods, or even better provide a minimal reproducer?

@Xnyle
Copy link
Author

Xnyle commented Nov 12, 2019

Ok, learned something new, while @NonBinding might solve my problem, shouldn't any interceptor annotation used without any parameters still match all the default values defined in the binding definition?

Which it does on Wildfly/Thorntail but not on Quarkus.

Although I haven't tested it, I think you can reuse https://github.com/quarkusio/quarkus/blob/master/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindings/MyTransactional.java, remove @NonBinding and then use @MyTransactional() without any parameters in InvocationContextBindingsTest.

That should reproduce my usecase and the expectation is that the interceptor still fires.

@gwenneg
Copy link
Member

gwenneg commented Nov 12, 2019

If it works with Wildfly and Thorntail but not with Quarkus, then it's worth asking @mkouba for his opinion.

@gwenneg gwenneg added the area/arc Issue related to ARC (dependency injection) label Nov 12, 2019
@mkouba
Copy link
Contributor

mkouba commented Nov 12, 2019

shouldn't any interceptor annotation used without any parameters still match all the default values defined in the binding definition?

Yes, I think that default values should be used for both the bean and the interceptor. In other words, the interceptor should be bound to a bean annotated with the binding that has the same annotation member value.

It's probably a bug. I'll look into the relevant parts of ArC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants