@Override
  protected void loadBeanDefinitions(GenericWebApplicationContext context,
      WebMergedContextConfiguration webMergedConfig) {
    start();
    super.loadBeanDefinitions(context, webMergedConfig);
    context.getServletContext().setAttribute(
        HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM,
        getSecurityService());
    context.getServletContext().setAttribute(
        HttpService.CLUSTER_MANAGEMENT_SERVICE_CONTEXT_PARAM,
        getClusterManagementService());
    context.getServletContext().setAttribute(HttpService.AUTH_TOKEN_ENABLED_PARAM,
        isAuthTokenEnabled());
    context.getServletContext().setAttribute("locator", this);
  }
This is quite horrible. In particular we're trying to link the lifecycle of the
LocatorStarterRule and Spring's application context. The locator is injected into the
ServletContext so that it can be retrieved and cleaned up in the LocatorCleanupEventListener.
There has to be a better way...
geode-web-management/src/commonTest/java/org/apache/geode/management/internal/rest/BaseLocatorContextLoader.java