How to properly reset/shutdown axon between integration tests

Skip to first unread message

Jul 17, 2020, 2:35:06 AM7/17/20
to Axon Framework Users
Hi everyone!

We're running integration tests which dirty the Spring context between test runs with:

@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)

This works. BUT: after each test is run, Axon will take an additional 1 minute for all of the connections, threads, etc to time out, after each test.

How do I properly reset/shutdown the Spring context with Axon running in it between tests?

I already tried applicationContext.getBean( but this let's the test fail.

Thanks, Martin

Steven van Beelen

Sep 16, 2020, 5:28:36 AM9/16/20
to Axon Framework Users
Hi Martin,

Axon as of 4.3 employees a grace full shutdown solution, making sure everything is closed and unsubscribed at the right time.
This solution should automatically kill everything at the end of an integration test as well, although it indeed might need some time.

So, without knowing the version you are on, I would recommend to move over to the latest (currently 4.4.2) to benefit from this.
If you already are on 4.3 or higher, then that warrants an investigation in more detail for which more information than "all of the connections, threads, etc".

Trusting this will help you further Martin!


PS. It is important to note that this mailing list will be discontinued as specified in this thread.
Instead of this mailing list we have moved to use a forum style of communication, at
Hope to see you there!

You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages