StudentSpringClient.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:iws 作者:
/**
 * Injects the {@code EntityManager} instance required to invoke our
 * transactional DAOs. The EntityManager instance can only be injected into
 * the Spring Beans, we cannot create a Spring Bean for the Exchange EJB
 * otherwise.
 *
 * @param entityManager Spring controlled EntityManager instance
 */
@PersistenceContext
public void init(final EntityManager entityManager) {
    // Create the Notification Spy, and inject it
    final Notifications notitications = NotificationSpy.getInstance();
    final NotificationManagerScheduler notificationBean = new NotificationManagerScheduler();
    notificationBean.setNotifications(notitications);

    // Create a new SessionRequestBean instance with our entityManager
    final SessionRequestBean sessionRequestBean = new SessionRequestBean();
    sessionRequestBean.setEntityManager(entityManager);
    sessionRequestBean.setSettings(Beans.settings());
    sessionRequestBean.postConstruct();

    // Create an Exchange EJB, and inject the EntityManager & Notification Spy
    final StudentBean studentBean = new StudentBean();
    studentBean.setEntityManager(entityManager);
    studentBean.setNotificationManager(notificationBean);
    studentBean.setSessionRequestBean(sessionRequestBean);
    studentBean.setSettings(Beans.settings());
    studentBean.postConstruct();

    // Set our Exchange implementation to the Exchange EJB, running withing
    // a "Spring Container".
    client = studentBean;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号