Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated ServletContextListener #3561

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

rbygrave
Copy link
Member

@rbygrave rbygrave commented Feb 12, 2025

Migrate to adding your own ServletContextListener like:

import jakarta.servlet.ServletContextEvent;

/**
 * Deprecated for removal - no intention to replace. Create your own copy of this
 * ServletContextListener if needed for your application.
 * <p>
 * Listens for webserver server starting and stopping events.
 * <p>
 * This should be used when the deployment is into a servlet container where the webapp
 * can be shutdown or redeployed without the JVM stopping.
 * </p>
 * <p>
 * If deployment is into a container where the JVM is completely shutdown (like spring boot,
 * runnable war or when using a servlet container that only contains the single webapp and
 * the JVM is shutdown then this isn't required. Instead we can just rely on the JVM shutdown
 * hook that Ebean registers.
 * </p>
 */
@Deprecated(forRemoval = true)
public class ServletContextListener implements jakarta.servlet.ServletContextListener {

  /**
   * The servlet container is stopping.
   */
  @Override
  public void contextDestroyed(ServletContextEvent event) {
    ShutdownManager.shutdown();
  }

  /**
   * Do nothing on startup.
   */
  @Override
  public void contextInitialized(ServletContextEvent event) {

  }

}

@rbygrave rbygrave self-assigned this Feb 12, 2025
@rbygrave rbygrave added this to the 14.9.0 milestone Feb 12, 2025
@rbygrave rbygrave merged commit 1f7117d into master Feb 12, 2025
1 check passed
@rbygrave rbygrave deleted the feature/remove-deprecated-servletContextListener branch February 12, 2025 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant