Skip to content

@Async support in spring-aspects with AspectJ [SPR-7369] #12027

Closed

Description

@spring-projects-issues

Keith Donald opened SPR-7369 and commented

I am using AspectJ for all aspects in my application, which right now includes ITDs and the @Transactional spring-aspect. I like the consistency in using AspectJ for AOP quite a bit, and would prefer to use it across the board rather than a hybrid approach. I now have a requirement to make a method @Async and noticed there doesn't appear to be an equivalent spring-aspect for this. It would be great to be able to make methods @Async with AspectJ in the same kind of way you can make methods @Transactional.

Perhaps Ramnivas could take a look at this?


Affects: 3.0.3

Issue Links:

Referenced from: commits 0098478, e1fb19f

Activity

  1. spring-projects-issues commented on Aug 23, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Ramnivas - care to comment?

  2. spring-projects-issues commented on Aug 23, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Ramnivas Laddad commented

    I am on it (will take one of the aspects around the same idea from AspectJ in Action and make it Spring-quality).

  3. spring-projects-issues commented on Aug 23, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Keith Donald commented

    Thanks Ramnivas! I'll use this feature as soon as you give me the word.

  4. spring-projects-issues commented on Sep 1, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Guys, would you mind moving this to 3.1? Since this isn't entirely trivial, I'm not really keen on sneaking this into next week's 3.0.5...

    Juergen

  5. spring-projects-issues commented on Sep 2, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Ramnivas, the 'next' branch is available and publishing 3.1 snapshots now. Keith, if you're OK upgrading your dependencies to this, then things would be seamless.

  6. spring-projects-issues commented on Sep 2, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Ramnivas Laddad commented

    Yes, 3.1 makes more sense for this, since that will allows us making backward incompatible changes during milestones, if needed.

  7. spring-projects-issues commented on Sep 29, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Rescheduled for 3.0.5 since we have an aspect in Roo which is known to work and hopefully easy enough to adapt for SFW.

    Juergen

  8. spring-projects-issues commented on Sep 29, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Stefan Schmidt commented

    On the Spring Roo side we have seen this problem when developing the Solr add-on as well. There are a number of (sometimes static) domain type methods offered (via ITDs) by this add-on which are better offered asynchronously. However, @Async was not picked up. As a workaround we are deploying a dedicated aspect:

    @Configurable
    public aspect SolrSearchAsyncTaskExecutor {
    
             @Autowired private ThreadPoolTaskExecutor taskExecutor;
              
             pointcut asyncMethods(): execution(void indexPets(..)) || execution(void indexPet(..)) || execution(void deleteIndex(..));
    
             void around(): asyncMethods() {
                     taskExecutor.execute(new Thread() {
                             public void run() {
                                     proceed();
                             }
                     });
             }
    }
    

    The pointcut could be adjusted to simply pick up methods which are annotated with @Async.

    So from a Roo perspective it would be nice to avoid the deployment of such an aspect alltogether.

  9. spring-projects-issues commented on Oct 6, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Ramnivas Laddad commented

    Support is now in 3.0.5.

    Stefan, can you check this out and let me know if it meets Roo's needs.

    I will port this over to 3.1 repository shortly.

  10. spring-projects-issues commented on Oct 7, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Hi Ramnivas - great, I'll have a look at this as well ASAP. Stefan of course is the primary driving force behind 3.0.x inclusion here.

    No need to port this over to 3.1 yet, actually: We'll do a general merge with recent 3.0.x changes once we're getting closer to 3.1 M1.

    Juergen

  11. spring-projects-issues commented on Oct 7, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Stefan Schmidt commented

    I have a test project ready to go against the latest SFW maven nightlies. However, those are not published yet because there was an unrelated build problem in Bamboo. So I am still waiting for something to test against ;).

  12. spring-projects-issues commented on Oct 11, 2010

    @spring-projects-issues
    CollaboratorAuthor

    Stefan Schmidt commented

    Ok, I was able to test this successfully after some additional feedback from Ramnivas. As soon as SFW 3.0.5 is released I will adjust the Roo Solr addon. Thanks for the quick turn around!

  13. added
    type: enhancement
    in: core
    on Jan 11, 2019
  14. added this to the 3.0.5 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coretype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions