Repository: vapor/vapor
File: Sources/Vapor/Application.swift (Swift)

Code before:
    }

    /// Starts the ``Application`` asynchronous using the ``startup()`` method, then waits for any running tasks
    /// to complete. If your application is started without arguments, the default argument is used.
    ///
    /// Under normal circumstances, ``execute()`` runs until a shutdown is triggered, then wait for the web server to
    /// (manually) shut down before returning.
    public func run() async throws {
        do {
            try await self.startup(from: self.configReader)
            try await self.running?.onStop.get()
        } catch {
            self.logger.report(error: error)
            throw error
        }
    }

    /// Used by the `_startup(addressConfiguration:)` method
    let box: NIOLockedValueBox<SendableBox> = .init(.init(didShutdown: false))
    
    /// When called, this will start running Vapor's webserver.
    ///
    /// If you start Vapor through this method, you'll need to prevent your Swift Executable from closing yourself.
    /// If you want to run your ``Application`` indefinitely, or until your code shuts the application down,
    /// use ``execute()`` instead.
    public func startup(from config: ConfigReader) async throws {
        try await self.boot()

        try await self._startup(addressConfiguration: AddressConfiguration(from: config))
    }

    /// Called when the applications starts up, will trigger the lifecycle handlers. The asynchronous version of ``boot()``
    public func boot() async throws {
        /// Skip the boot process if already booted
        guard !self.isBooted.withLockedValue({
            var result = true
            swap(&$0, &result)
            return result
        }) else {
            return
        }

        for handler in self.lifecycle.handlers {
            try await handler.willBoot(self)
        }
        for handler in self.lifecycle.handlers {
            try await handler.didBoot(self)
        }
    }

    public func shutdown() async throws {

Review comment (suggestion):
Here we could use `self.configReader` instead of passing it as an argument, but I guess this code is going to change a lot for Swift Service Lifecycle

Code after:
        self.core.initialize()
        self.sessions.initialize()
        self.sessions.use(.memory)
        self.servers.initialize()
        self.servers.use(.httpNew)
    }

    /// Starts the ``Application`` asynchronous using the ``startup()`` method, then waits for any running tasks
    /// to complete. If your application is started without arguments, the default argument is used.
    ///
    /// Under normal circumstances, ``execute()`` runs until a shutdown is triggered, then wait for the web server to
    /// (manually) shut down before returning.
    public func run() async throws {
        do {
            try await self.startup()
            try await self.running?.onStop.get()
        } catch {
            self.logger.report(error: error)
            throw error
        }
    }

    /// Used by the `_startup(addressConfiguration:)` method
    let box: NIOLockedValueBox<SendableBox> = .init(.init(didShutdown: false))
    
    /// When called, this will start running Vapor's webserver.
    ///
    /// If you start Vapor through this method, you'll need to prevent your Swift Executable from closing yourself.
    /// If you want to run your ``Application`` indefinitely, or until your code shuts the application down,
    /// use ``execute()`` instead.
    public func startup() async throws {
        try await self.boot()

        try await self._startup(addressConfiguration: AddressConfiguration(from: self.configReader))
    }

    /// Called when the applications starts up, will trigger the lifecycle handlers. The asynchronous version of ``boot()``
    public func boot() async throws {
        /// Skip the boot process if already booted
        guard !self.isBooted.withLockedValue({
            var result = true
            swap(&$0, &result)
            return result
        }) else {
            return
        }

        for handler in self.lifecycle.handlers {
            try await handler.willBoot(self)
        }
        for handler in self.lifecycle.handlers {