Using generics for ApplicationListener method