added applicationcontext to before and after events