# getPodFactory method

1. @override

ConfigurableListablePodFactory getPodFactory()
override

🫘 Returns the underlying ConfigurableListablePodFactory.

The ConfigurableListablePodFactory is the core dependency injection container responsible for:

- Pod definition registration and storage
- Dependency injection and resolution
- Singleton management and caching
- Lifecycle coordination
- Circular dependency detection and handling

### Advanced Operations:

Accessing the pod factory directly enables advanced scenarios that go beyond basic pod retrieval:

    final factory = context.getPodFactory();

    // Programmatic pod registration
    factory.registerDefinition('customService',
      RootPodDefinition(type: Class<CustomService>()));

    // Query pod definitions
    final podNames = factory.getDefinitionNames();
    final hasService = factory.containsDefinition('myService');

    // Check pod relationships
    final dependencies = factory.getDependenciesForPod('userService');

    // Manual singleton registration
    factory.registerSingleton('config', ConfigService());

    // Advanced pod retrieval with type safety
    final service = factory.getPod<MyService>('myService');

    // Check pod existence and type compatibility
    if (factory.isTypeMatch('dataSource', Class<DataSource>())) {
      final ds = factory.getPod<DataSource>('dataSource');
    }

### Important Notes:

- Use with caution in application code - prefer dependency injection
- Be aware of lifecycle state when performing operations
- Consider thread safety for concurrent access
- Factory modifications may require context refresh to take effect

## Implementation

    @override
    ConfigurableListablePodFactory getPodFactory() {
      if (podFactory == null) {
        if (getIsRefreshed()) {
          throw IllegalStateException("Cannot access pod factory since it has not been initialized yet.");
        } else {
          return _podFactory;
        }
      }

      return podFactory!;
    }