withDesignRole abstract method

Spec<T> withDesignRole(
  1. DesignRole role, {
  2. bool isPrimary = false,
})

Assigns a design role to this pod, with an option to mark it as isPrimary for autowiring resolution.

  • Use roles to categorize pods (e.g., "controller", "repository").
  • If multiple candidates exist, isPrimary: true helps resolve ambiguity.

Example

spec.withDesignRole(DesignRole.service, isPrimary: true);

Implementation

Spec<T> withDesignRole(DesignRole role, {bool isPrimary = false});