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

@Async isn't applied, if the interface doesn't have concrete implementation [SPR-11910] #16529

Closed
spring-projects-issues opened this issue Jun 25, 2014 · 4 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 25, 2014

Artem Bilan opened SPR-11910 and commented

If we add @Async fo the interface method, but don't provide an implementation for the interface, we and end up with issue, when @Async can't be applied and java.lang.IllegalArgumentException: Class must not be null is thrown.

Can't we use the same AutoProxyRegistrar technique for @Async as it is for @Transactional?
I mean build a new Proxy independently of target bean state.

I understand that AsyncExecutionAspectSupport should be the first one in the chain, but it looks like we have a limitation on the matter, if we don't provide a real implementation for our annotated interface.

The Spring Integration infrastructure just creates proxy fo the provided interface and that's all.

See linked issue INT-3448


Affects: 4.0.5

Issue Links:

  • INT-3448 Gateway proxy for @Async method throws NullPointerException ("is depended on by")
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 26, 2014

Juergen Hoeller commented

The root of the problem turned out to be in DefaultAdvisorChainFactory: getInterceptorsAndDynamicInterceptionAdvice receives a null targetClass in a scenario without a target instance, but then goes on passing into ClassFilters... which don't expect null. A simple fallback to method.getDeclaringClass() does the job there.

I'll also backport this to 4.0.6.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 27, 2014

Artem Bilan commented

Thanks, Juergen!

Let me know, when it will be backported to to 4.0.6 to provide the test case on the matter and confirm it within our JIRA.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 2, 2014

Juergen Hoeller commented

Hey Artem, this has been available in 4.0.6 snapshots for a while... Would be great to verify this with your use case before releasing it tomorrow!

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 2, 2014

Artem Bilan commented

Thank you, Juergen.

The fix really works like a charm. Here is a SI PR to confirm it: spring-projects/spring-integration#1192.

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.6 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants