ensures applicationeventsresolver is disposed of in the correct place.