Description
I’m working on a project where we maintain a custom IoC container alongside the Spring ApplicationContext. We want Spring’s dependency injection to:
First try to resolve beans from its own ApplicationContext
If not found, dynamically fallback to our custom container — without pre-registering all custom beans into Spring
Currently, Spring throws NoSuchBeanDefinitionException when a required bean is missing, and no out-of-the-box extension point allows fallback lookup into external containers.
Use Cases
Applications maintaining multiple IoC containers for legacy or architectural reasons
Using external container beans only if Spring context doesn’t have them
Avoid premature registration or duplication of beans in Spring
Enable lazy, on-demand integration of external beans to reduce startup time and resource consumption
Proposed Feature
Provide a pluggable extension point (e.g., a fallback BeanFactory or BeanResolver chain) for bean resolution
Allow Spring to delegate bean lookups that fail locally to external containers
Support fallback during autowiring, lookup by name, and via ObjectProvider
Seamless integration with Spring Boot’s auto-configuration and lifecycle management
Benefits
Increased flexibility to coexist with other IoC containers
Supports hybrid container architectures without heavy customization
Reduces complexity and boilerplate for dynamic bean resolution scenarios
Thanks for your consideration and for maintaining such a powerful framework!