Register Login
Internet / AI Technology University (ITU/AITU)
Created by info@itofthefuture.com
Welcome Anonimous.User to this quiz related to Spring Test.

Read the question and choose the best answer. Time is limited to 40 seconds!

Important! Do not forget to rank the quality of the question (from bad to excellent).
An initiator of the quiz will get royalty score for QnAs created by her/him and can win the Top Creativity Prize.
Question:
What method of bean creation is used in the code below?
public class ExampleBean {

    ...

    // a private constructor
    private ExampleBean(...) {
      ...
    }
    
    public static ExampleBean createInstance(
            AnotherBean anotherBean, YetAnotherBean yetAnotherBean, int i) {
        ExampleBean eb = new ExampleBean(...);
        // some other operations
        ...
        return eb;
    }
}

<bean id="exampleBean" class="examples.ExampleBean">
  <constructor-arg><ref bean="anotherExampleBean"/></constructor-arg>
  <constructor-arg><ref bean="yetAnotherBean"/></constructor-arg>
  <constructor-arg><value>1</value></constructor-arg>
</bean>
<bean id="anotherExampleBean" class="examples.AnotherBean"/>
<bean id="yetAnotherBean" class="examples.YetAnotherBean"/>

Factory-based



The code is invalid. Xml definition uses factory-based but the code is constructor-based.



Setter-based



The code is invalid. Xml definition uses constructor-based but the code is setter-based.



Constructor-based



The code is invalid. Xml definition uses constructor-based but the code is factory-based.



Rank the Quality of the Question from "-10" (bad) or "0" (not clear) to 10 (correct) or even 20 (very good!)
-10 (bad/wrong) 0 (not clear) 10 (correct) 20 (very good!)
Your summary report will be available to you and your instructor. Thank you for your work!!!