@Override
    public void serviceAdded(ServiceConfig cfg) throws Exception {
        super.serviceAdded(cfg);

        if (server != null) {
            if (server != cfg.server()) {
                throw new IllegalStateException("cannot be added to more than one server");
            } else {
                return;
            }
        }

        server = cfg.server();

        // Build the Specification after all the services are added to the server.
        final ServerConfig config = server.config();
        final List<VirtualHost> virtualHosts = config.findVirtualHosts(this);

        final List<ServiceConfig> services =
                config.serviceConfigs().stream()
                      .filter(se -> virtualHosts.contains(se.virtualHost()))
                      .collect(toImmutableList());
        final ExecutorService executorService = Executors.newSingleThreadExecutor(
                ThreadFactories.newThreadFactory("docservice-loader", true));
        vfs().specificationLoader.updateServices(services, cfg.route(), executorService).handle((res, e) -> {
            if (e != null) {
                logger.warn("Failed to load specifications completely: ", e);
            }
            executorService.shutdown();
            return null;
        });
    }
Creates a new instance with example HTTP headers and example requests and injected scripts.
core/src/main/java/com/linecorp/armeria/server/docs/DocService.java