Source:
public void withInjector(Injector injector) { insertValidationEventListeners(injector); ResourceLocatorMap map = injector.getInstance(ResourceLocatorMap.class); map.init(); if (config.getBoolean(ConfigProperties.AMQP_INTEGRATION_ENABLED)) { if (!config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) { QpidQmf qmf = injector.getInstance(QpidQmf.class); QpidStatus status = qmf.getStatus(); if (status != QpidStatus.CONNECTED) { log.error("Qpid is in status {}. Please fix Qpid configuration " + "and make sure Qpid is up and running. Candlepin will shutdown now.", status); throw new RuntimeException("Error during Startup: Qpid is in status " + status); } } QpidStatusMonitor qpidMonitor = injector.getInstance(QpidStatusMonitor.class); qpidMonitor.addStatusChangeListener(injector.getInstance(QpidConnection.class)); if (config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) { qpidMonitor.addStatusChangeListener(injector.getInstance(SuspendModeTransitioner.class)); } qpidMonitor.run(); qpidMonitor.schedule(); } if (config.getBoolean(ACTIVEMQ_ENABLED)) { activeMQContextListener = injector.getInstance(ActiveMQContextListener.class); activeMQContextListener.contextInitialized(injector); } if (config.getBoolean(ConfigProperties.CACHE_JMX_STATS)) { CacheManager cacheManager = injector.getInstance(CacheManager.class); cacheManager.getCacheNames().forEach(name -> { log.info("Enabling management and statistics for " + name + " cache"); cacheManager.enableManagement(name, true); cacheManager.enableStatistics(name, true); }); } pinsetterListener = injector.getInstance(PinsetterContextListener.class); pinsetterListener.contextInitialized(); loggerListener = injector.getInstance(LoggerContextListener.class); ModelConverters.getInstance() .addConverter(injector.getInstance(CandlepinSwaggerModelConverter.class)); if (config.getBoolean(ConfigProperties.KEYCLOAK_AUTHENTICATION)) { CandlepinCapabilities capabilities = CandlepinCapabilities.getCapabilities(); capabilities.add(CandlepinCapabilities.KEYCLOAK_AUTH_CAPBILITY); } this.injector = injector; }

Target:
public void withInjector(Injector injector) { insertValidationEventListeners(injector); ResourceLocatorMap map = injector.getInstance(ResourceLocatorMap.class); map.init(); if (config.getBoolean(ConfigProperties.AMQP_INTEGRATION_ENABLED)) { if (!config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) { QpidQmf qmf = injector.getInstance(QpidQmf.class); QpidStatus status = qmf.getStatus(); if (status != QpidStatus.CONNECTED) { log.error("Qpid is in status {}. Please fix Qpid configuration " + "and make sure Qpid is up and running. Candlepin will shutdown now.", status); throw new RuntimeException("Error during Startup: Qpid is in status " + status); } } QpidStatusMonitor qpidMonitor = injector.getInstance(QpidStatusMonitor.class); qpidMonitor.addStatusChangeListener(injector.getInstance(QpidConnection.class)); if (config.getBoolean(ConfigProperties.SUSPEND_MODE_ENABLED)) { qpidMonitor.addStatusChangeListener(injector.getInstance(SuspendModeTransitioner.class)); } qpidMonitor.run(); qpidMonitor.schedule(); } if (config.getBoolean(ACTIVEMQ_ENABLED)) { activeMQContextListener = injector.getInstance(ActiveMQContextListener.class); activeMQContextListener.contextInitialized(injector); } if (config.getBoolean(ConfigProperties.CACHE_JMX_STATS)) { CacheManager cacheManager = injector.getInstance(CacheManager.class); cacheManager.getCacheNames().forEach(cacheName -> { log.info("Enabling management and statistics for cache", cacheName); cacheManager.enableManagement(cacheName, true); cacheManager.enableStatistics(cacheName, true); }); } pinsetterListener = injector.getInstance(PinsetterContextListener.class); pinsetterListener.contextInitialized(); loggerListener = injector.getInstance(LoggerContextListener.class); ModelConverters.getInstance() .addConverter(injector.getInstance(CandlepinSwaggerModelConverter.class)); if (config.getBoolean(ConfigProperties.KEYCLOAK_AUTHENTICATION)) { CandlepinCapabilities capabilities = CandlepinCapabilities.getCapabilities(); capabilities.add(CandlepinCapabilities.KEYCLOAK_AUTH_CAPBILITY); } this.injector = injector; }