feat: add field injection after constructor injection
Enable @Inject field injection in the bean creation lifecycle. Fields are now injected after constructor injection and before PostConstruct invocation, allowing beans to use both constructor and field injection simultaneously. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -112,6 +112,8 @@ public class BeanFactory {
|
||||
} else {
|
||||
instance = createBeanFromConstructor(definition);
|
||||
}
|
||||
// 在构造器注入后执行字段注入
|
||||
injectFields(instance);
|
||||
if (definition.getScope() == ScopeType.SINGLETON) {
|
||||
context.setSingleton(name, instance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user