# autowireByName method

1. @protected

Future<void> autowireByName(

1. String podName,
2. RootPodDefinition root,
3. PodHolder ph,
4. MutablePropertyValues pvs,

)

Performs autowiring by name for the pod instance.

This method looks for pods in the factory that match property names and injects them into the corresponding fields or setters.

@param podName The name of the pod being wired @param root The pod definition @param ph The pod holder @param pvs The property values to populate

## Implementation

    @protected
    Future<void> autowireByName(String podName, RootPodDefinition root, PodHolder ph, MutablePropertyValues pvs) async {
      Map<String, Class> nonSatisfiedProperties = getUnsatisfiedNonSimpleProperties(root, ph);
      for (final entry in nonSatisfiedProperties.entries) {
        String propertyName = entry.key;
        Class type = entry.value;

        if (await containsPod(propertyName)) {
          Object pod = await getPod(propertyName);
          pvs.add(propertyName, pod, qualifiedName: type.getQualifiedName(), packageName: type.getPackage()?.getName());
          registerDependentPod(propertyName, podName);

          if(logger.getIsTraceEnabled()) {
            logger.trace("Added autowiring by name from pod name '$podName' via property '$propertyName' to pod named '$propertyName'");
          }
        } else {
          if (logger.getIsTraceEnabled()) {
            logger.trace("Could not autowire by name from pod name '$podName' via property '$propertyName' to pod named '$propertyName'");
          }
        }
      }
    }