# create method

Future<ConfigurableApplicationContext?> create(

1. List<String> args,
2. RuntimeProvider? provider

)

Creates and initializes the application context.

This is the main entry point for application creation and initialization. It handles runtime detection, bootstrap context creation, and application context building.

### Process Flow:

1. Runtime Detection: Detect AOT vs JIT compilation and validate runtime
2. Bootstrap: Create bootstrap context and register early components
3. Listeners: Collect and initialize application run listeners
4. Context Building: Create and configure the application context
5. Startup: Refresh context and execute application runners

`args` command line arguments passed to the application `provider` optional runtime provider for environment detection

Returns a ConfigurableApplicationContext representing the running application

Throws:

- `ApplicationContextException` if context creation fails
- IllegalStateException if runtime requirements are not met

Example:

    final app = JetApplication(MyApp);
    final context = await app.create(args, null);

## Implementation

    Future<ConfigurableApplicationContext?> create(List<String> args, RuntimeProvider? provider) async {
      final system = _detector.detect(args);
      _runtimeProvider = provider;

      /// As at v1.0.0, we have two different ways of running the `JetLeaf` application.
      ///
      /// 1. Running from a built application:
      ///    Here, the application has been built and contains all that it needs to run.
      ///    This is mostly seen when the developer is done building and wants to deploy the application.
      ///    At this point, Jetleaf enforces the check of AOT and RuntimeProvider since it is crucial to
      ///    providing the maximum experience the user needs.
      ///
      /// 2. Running on development or JIT:
      ///    This does not require the RuntimeProvider to be present at the time of running the application,
      ///    because Jetleaf since has its authority over the application, it can automatically build
      ///    the application and run it.
      ///
      /// We provide these two different ways to make the developer's experience swift and better.
      /// Since we cannot control how the run method executes from the user's IDE, we simulate such experience
      /// by detecting where the application is running from, in order to decide what to level with.

      if(system.isRunningAot() && _runtimeProvider == null) {
        /// Since the build pipeline failed, we can't proceed with the application startup.
        /// At this point, nothing has been initialized, so we will exit the application gracefully with
        /// just [System.out.println].
        System.out.printErr('''
          Application failed to start. Did you forget to bootstrap or build the application?

          For development, you need to use the `JetLeaf` cli command to run your application.
            - `jl dev`
              Bootstraps your application and runs it in development mode.

          For production, you need to use the `JetLeaf` cli command to build your application. Then,
          utilize the dart run command with the target file to run your application.
            - `jl generate`
              Builds the bootstrap file that contains all you source code offers.
            - `jl build`
              Compiles your application to fat .dill file.
            - `jl serve`
              Runs `generate` and `build` at the same time, simultaneously.
            - `dart run build/main.dill`
              Runs your application in production mode.
        ''');
        System.exit(1);
      }

      /// At this point, the application is presumed to have been fully bootstrapped by the developer,
      /// compiled and ready to execute fully functional .dill file, .dart file, .exe file.
      ///
      /// So, we will just go ahead to create the [ConfigurableApplicationContext] and start the application.
      return _create(args);
    }