In the axon “Command Dispatching” documentation (https://docs.axonframework.org/v/3.1/part3/command-dispatching.html#asynchronouscommandbus) there is some advice to shut down the bus when stopping the application. I came up with a solution, but it seems a little contrived and was hoping someone could steer me in the right direction.
Below is a snippet from my axon configuration class. I have defined a custom extension of AsynchronousCommandBus with a @PreDestroy annotated method which I configure as the command bus: