public static void configureServerWithArmeriaSettings(
            ServerBuilder server,
            ArmeriaSettings settings,
            InternalServices internalServices,
            List<ArmeriaServerConfigurator> armeriaServerConfigurators,
            List<Consumer<ServerBuilder>> armeriaServerBuilderConsumers,
            MeterRegistry meterRegistry,
            MeterIdPrefixFunction meterIdPrefixFunction,
            List<MetricCollectingServiceConfigurator> metricCollectingServiceConfigurators,
            List<DependencyInjector> dependencyInjectors,
            List<ServerErrorHandler> serverErrorHandlers,
            BeanFactory beanFactory) {

        requireNonNull(server, "server");
        requireNonNull(settings, "settings");
        requireNonNull(armeriaServerConfigurators, "armeriaServerConfigurators");
        requireNonNull(armeriaServerBuilderConsumers, "armeriaServerBuilderConsumers");
        requireNonNull(meterRegistry, "meterRegistry");
        requireNonNull(metricCollectingServiceConfigurators, "metricCollectingServiceConfigurators");

        final Port internalServicePort = internalServices.internalServicePort();
        final Port managementServerPort = internalServices.managementServerPort();
        final ImmutableList.Builder<Port> internalPortsBuilder = ImmutableList.builder();
        if (internalServicePort != null) {
            internalPortsBuilder.add(internalServicePort);
        }

        final boolean needsManagementPort =
                findBean(beanFactory, "actuatorServerConfigurator", ArmeriaServerConfigurator.class) != null;

        if (needsManagementPort && managementServerPort != null) {
            internalPortsBuilder.add(managementServerPort);
        }
        final List<Port> internalPorts = dedupPorts(internalPortsBuilder.build());
        configurePorts(server, dedupPorts(settings.getPorts()));
        configurePorts(server, internalPorts);
        configureSettings(server, settings);

        if (settings.getGracefulShutdownQuietPeriodMillis() >= 0 &&
            settings.getGracefulShutdownTimeoutMillis() >= 0) {
            server.gracefulShutdownTimeoutMillis(settings.getGracefulShutdownQuietPeriodMillis(),
                                                 settings.getGracefulShutdownTimeoutMillis());
            logger.debug("Set graceful shutdown timeout: quiet period {} ms, timeout {} ms",
                         settings.getGracefulShutdownQuietPeriodMillis(),
                         settings.getGracefulShutdownTimeoutMillis());
        }

        final InternalServiceProperties internalServiceProperties = settings.getInternalServices();
        final List<InternalServiceId> internalServiceIds;
        if (internalServiceProperties == null) {
            internalServiceIds = InternalServiceId.defaultServiceIds();
        } else {
            internalServiceIds = internalServiceProperties.getInclude();
        }

        configureInternalService(server, InternalServiceId.DOCS, settings.getDocsPath(),
                                 internalServices.docService(),
                                 internalPorts, internalServiceIds, true);

        configureInternalService(server, InternalServiceId.HEALTH, settings.getHealthCheckPath(),
                                 internalServices.healthCheckService(),
                                 internalPorts, internalServiceIds, false);

        server.meterRegistry(meterRegistry);

        if (settings.getSsl() != null) {
            configureTls(server, settings.getSsl());
        }

        final ArmeriaSettings.Compression compression = settings.getCompression();
        if (compression != null && compression.isEnabled()) {
            final int minBytesToForceChunkedAndEncoding =
                    Ints.saturatedCast(parseDataSize(compression.getMinResponseSize()));
            server.decorator(contentEncodingDecorator(compression.getMimeTypes(),
                                                      compression.getExcludedUserAgents(),
                                                      minBytesToForceChunkedAndEncoding));
        }

        if (settings.isEnableMetrics()) {
            if (!metricCollectingServiceConfigurators.isEmpty()) {
                final MetricCollectingServiceBuilder builder = MetricCollectingService
                        .builder(meterIdPrefixFunction);
                for (MetricCollectingServiceConfigurator configurator : metricCollectingServiceConfigurators) {
                    configurator.configure(builder);
                }
                server.decorator(builder.newDecorator());
            } else {
                server.decorator(MetricCollectingService.newDecorator(meterIdPrefixFunction));
            }

            configureInternalService(server, InternalServiceId.METRICS, settings.getMetricsPath(),
                                     internalServices.metricsExpositionService(), internalPorts,
                                     internalServiceIds, false);
        }

        // dependencyInjectors from beans are added first, which will be used first thing,
        // then from armeriaServerConfigurators and armeriaServerBuilderConsumers.
        dependencyInjectors.forEach(injector -> {
            server.dependencyInjector(injector, false); // The injector is closed by Spring.
        });
        if (settings.isEnableAutoInjection()) {
            server.dependencyInjector(SpringDependencyInjector.of(beanFactory), false);
        }
        // serverErrorHandlers from beans are added first, which will be used first thing,
        // then from armeriaServerConfigurators and armeriaServerBuilderConsumers.
        serverErrorHandlers.forEach(server::errorHandler);

        // armeriaServerConfigurators and armeriaServerBuilderConsumers will override the properties set
        // via ArmeriaSettings.
        armeriaServerConfigurators.forEach(configurator -> configurator.configure(server));
        armeriaServerBuilderConsumers.forEach(consumer -> consumer.accept(server));
    }
Sets graceful shutdown timeout, health check service and {@link MeterRegistry} for the specified
{@link ServerBuilder}.
spring/boot3-autoconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java