@Component
public class ApplicationContextHolder implements ApplicationContextAware {
private static ApplicationContext context;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
public static ApplicationContext getContext() {
return context;
}
public static <T> T getBean(Class<T> clazz) {
return ApplicationContextHolder.getContext().getBean(clazz);
}
}
В лисенере:
ApplicationContextHolder.getBean(WebDriver.class)
Не филигранно, но работает ))