org.apache.struts2.dispatcher

## Interface ContextAwareDestroyable

- All Superinterfaces:
    InternalDestroyable
  All Known Implementing Classes:
    FreemarkerCacheDestroyable

      public interface ContextAwareDestroyable
      extends InternalDestroyable

  Extension of `InternalDestroyable` for components that require `ServletContext` during cleanup (e.g. clearing servlet-scoped caches).

  During `Dispatcher.cleanup()`, the discovery loop checks each `InternalDestroyable` bean: if it implements this subinterface, `destroy(ServletContext)` is called instead of `destroy()`.

  Since:
    6.9.0
  See Also:
    `InternalDestroyable`, `Dispatcher.cleanup()`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `destroy()` Default no-op — `Dispatcher` calls `destroy(ServletContext)` instead when it recognises this type.
    `void` | `destroy(javax.servlet.ServletContext servletContext)` Releases state that requires access to the `ServletContext`.

- - ### Method Detail

    - #### destroy

          void destroy(javax.servlet.ServletContext servletContext)

      Releases state that requires access to the `ServletContext`.
      Parameters:
        `servletContext` - the current servlet context, may be `null` if the Dispatcher was created without one

    - #### destroy

          default void destroy()

      Default no-op — `Dispatcher` calls `destroy(ServletContext)` instead when it recognises this type.
      Specified by:
        `destroy` in interface `InternalDestroyable`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.