Type Register
Remy DI supports four different bind types for registering dependencies. Each type has different instantiation behavior and lifecycle characteristics.
- LazySingleton - Creates a single instance when first requested. Useful for expensive objects that may not always be needed.
- Singleton - Creates a single instance immediately during registration. Thread-safe singleton pattern.
- Factory - Creates a new instance every time the service is requested. Safe for concurrent use.
- Instance - Registers an existing value directly. Best for immutable values or configuration.
- RegisterConstructor - Convenient way to register
constructor functions without manually writing the
Binderfunction. Automatically handles dependency injection for constructor arguments.