Provides dependency injection patterns for Spring Boot projects, including constructor-first design, optional collaborator handling, bean selection, and wiring…
Constructor-first dependency injection patterns for Spring Boot with optional collaborator handling and bean selection strategies. Prioritizes constructor injection to keep dependencies explicit, immutable, and testable without Spring context. Handles optional dependencies through guarded setters, ObjectProvider, and deterministic no-op defaults. Resolves bean ambiguity using @Primary, @Qualifier, profiles, and conditional annotations (@ConditionalOnProperty, @ConditionalOnMissingBean). Includes validation workflows covering unit tests with mocks, slice tests, and Spring context verification before integration testing. Requires Java 17+ and Spring Boot 3.5.x; provides reference materials and progressive examples from basic constructor injection to multi-module configurations. Spring Boot Dependency Injection Overview Provides constructor-first dependency injection patterns for Spring Boot: mandatory collaborators via constructor injection optional collaborators via ObjectProvider or no-op fallbacks bean selection via @Primary and @Qualifier validation via minimal context tests before full integration When to Use Use this skill when: creating a new @Service, @Component, @Repository, or @Configuration class replacing field injection in legacy Spring code resolving multiple beans of the same type with qualifiers or primary beans handling optional features, adapters, or integrations without null-driven wiring reviewing circular dependencies or brittle context startup failures preparing code for direct constructor-based unit testing
don't have the plugin yet? install it then click "run inline in claude" again.