package org.diagbot.nlp.common;


import org.diagbot.common.service.StandardInfoService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class InitListener implements ServletContextListener {

    @Autowired
    StandardInfoService standardInfoService;

    public void contextDestroyed(ServletContextEvent arg0) {

    }

    /**
     * 开始初始化数据
     *
     * @return
     */
    public void contextInitialized(ServletContextEvent event) {
        contextStandardLibraryInitialized(event);
    }

    public void contextStandardLibraryInitialized(ServletContextEvent event) {
        ApplicationCacheUtil applicationCacheUtil = new ApplicationCacheUtil();
        applicationCacheUtil.putStandardInfoContext(event.getServletContext(), standardInfoService);
    }
}
