/** * Registers the {@code Lifecycle} and {@code ServletContextAware} aspects of the specified * instance. * * @param instance the object to examine, not null */ private void registerInstanceInterfaces0(final Object instance) { if (instance instanceof Lifecycle) { registerLifecycle0((Lifecycle) instance); } else { findAndRegisterLifeCycle(instance); } if (instance instanceof ServletContextAware) { registerServletContextAware0((ServletContextAware) instance); } }
/** * Registers a non-component object implementing {@code Lifecycle}. * * <p>Certain interfaces are automatically detected. If it implements {@code InitializingBean}, * then it will be initialized as though using {@link #initialize(InitializingBean)}. * * @param servletContextAware the object that requires a servlet context, not null */ public void registerServletContextAware(final ServletContextAware servletContextAware) { ArgumentChecker.notNull(servletContextAware, "servletContextAware"); checkStatus(Status.CREATING); try { initialize0(servletContextAware); registerServletContextAware0(servletContextAware); _logger.logDebug(" Registered lifecycle-stop: " + servletContextAware); } catch (final RuntimeException ex) { _status.set(Status.FAILED); throw new RuntimeException( "Failed during registering ServletContextAware: " + servletContextAware, ex); } }