阅读(694) (1)

Hasor 使用 ServletContextListener

2017-10-09 15:42:13 更新

在 Hasor Web 中使用 ServletContextListener 如下所示,首先编写我们自己的 ServletContextListener,然后将它注册到 Hasor 中:

public class MyServletContextListener implements ServletContextListener {
    ...
}


然后将其注册到 Hasor 框架中:

public class StartModule extends WebModule {
    public void loadModule(WebApiBinder apiBinder) throws Throwable {
        ...
        apiBinder.addServletListener(MyServletContextListener.class);
        ...
    }
}