@Component
Inject dependent objects from the Pixie System
Purpose: Indicates that a constructor parameter should be injected as a component dependency.
Example
public class ShoppingCart {
public ShoppingCart(@Param("processor") @Component
final PaymentProcessor processor) {
// ...
}
}
Pixie resolves @Component references in several ways:
- By Name —
cart.processor = @stripereferences a specific component - By Type — omit the property and Pixie finds a match automatically
- Collections — use
List<T>to inject multiple components - Generics — generic type arguments narrow which components match
See the References section for full details on each resolution mode.