春のライフサイクルについて混乱しています。
XmlBeanFactory beanFactory
= new XmlBeanFactory(new ClassPathResource("SpringHelloWorld.xml"));
上記のコードスニペットがオブジェクトを作成するかどうか?
上記の答えが正しい場合。
a)次に、スコープが「シングルトン」であるBeanの場合、上記のコードスニペットで作成されたオブジェクトを取得します。私は正しいですか、間違っていますか?
b)スコープが「プロトタイプ」の場合、作成されたオブジェクトが未使用かどうか。なぜなら、コンテナは常に新しいオブジェクトを返すからです。
XmlBeanFactory beanFactory
= new XmlBeanFactory(new ClassPathResource("SpringHelloWorld.xml"));
上記のコードスニペットがオブジェクトを作成するかどうか?
答えが間違っている場合、
SpringFrameworkがBeanの定義が正しいかどうかを検証する方法。
From the answer of Henry
Usually, singleton beans are created when the context starts. This can be changed with the lazy-init or default-lazy-init attributes.
Prototype beans are only created when needed.
Only syntactically, there might still be errors when the bean is instantiated, for example if a required property is not provided.