|
使用此规则来检测实现 WebLogic weblogic.application.ApplicationLifecycleListener
接口的类。这些类不在 WebSphere Application Server 上运行。建议的迁移替代方法是使用
javax.servlet.ServletContextListener 接口。
根据 ApplicationLifecycleListener 实现的复杂性,可使用
ServletContextListener contextInitialized 方法实现来包装
ApplicationLifecycleListener preStart 和 ApplicationLifecycleListener postStart 方法。
类似地,可使用 ServletContextListener contextDestroyed 方法实现来包装
ApplicationLifecycleListener preStop 和 ApplicationLifecycleListener postStop 方法。
在实现 ServletContextListener 之后,将需要更新 war 模块的 web.xml。
具体来说,需要将 ServletContextListener 接口的实现作为
listener-class 元素添加。请参考以下示例,以了解用于更新 web.xml 的正确语法。
<web-app id="WebApp_ID">
...
<listener>
<listener-class>com.acme.demo.impl.MyServletContextListenerImpl</listener-class>
</listener>
...
</web-app>
有关更多信息,请参阅 Interface javax.servlet.ServletContextListener Java 文档。
|