package sk.vrto.web.views.providers;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import sk.vrto.domain.Email;
import sk.vrto.web.presenters.EmailPresenter;
import sk.vrto.web.views.EmailView;
@Component
public class EmailViewProvider implements ApplicationContextAware {
private ApplicationContext applicationContext;
public EmailView get(Email email) {
return new EmailView(applicationContext.getBean(EmailPresenter.class), email);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}