# doGetFreshPodFactory method

1. @override

Future<ConfigurableListablePodFactory> doGetFreshPodFactory()
override

Returns a fresh ConfigurableListablePodFactory for this context.

Subclasses must implement this to provide a new factory instance whenever the context is refreshed.

Example:

    @override
    Future<ConfigurableListablePodFactory> doGetFreshPodFactory() async {
    return DefaultListablePodFactory();
    }

This is part of Jetleaf – a framework which developers can use to build web applications.

## Implementation

    @override
    Future<ConfigurableListablePodFactory> doGetFreshPodFactory() async {
      if(podFactory != null) {
        clearSingletonCache();
        clearMetadataCache();
        destroySingletons();
        destroyPods();
        podFactory = null;
      }

      final factory = DefaultListablePodFactory();
      factory.copyConfigurationFrom(_podFactory);
      factory.setDependencyComparator(AnnotationAwareOrderComparator());

      return factory;
    }