Free CoreSpringV3.2 Exam Braindumps (page: 7)

Page 6 of 25

Given an ApplicationContext containing multiple bean definitions of a Java type "Foo", which of the following @Autowired scenarios will cause the ApplicationContext to FAIL to initialize? Assume that the ApplicationContext is configured to process the @Autowired annotations. (Select one)

  1. @Autowired public void setFoo(Foo aFoo) {}
  2. @Autowired private Foo foo;
  3. Both a and b
  4. Neither a or b

Answer(s): C



Which of the following are valid mechanisms of autowiring a dependency when multiple beans match the dependency’s type? (Select one or several answers)

  1. Use of the @Qualifier and @Autowired annotations together on a field
  2. Use of the @Qualifier and @Autowired annotations together with setter methods
  3. Use of the @Qualifier annotation solely

Answer(s): A,B



Which of the following statements is NOT true concerning Setter Injection or Constructor Injection? (Select one)

  1. Constructor injection is useful when you must have an instance of a dependency class before your component is used
  2. Setter injection is useful if a component can provide its own defaults
  3. Using the @Autowired annotation, setter injection also works when the setter method is private
  4. Using setters promotes immutability

Answer(s): D



If you annotate one of your classes with @Component, which of the following should you do to have Spring automatically detect your class and load it as a bean? (Select one or several answers)

  1. Ensure that you specify a valid bean name in the @Component annotation
  2. Ensure that you specify a valid @Scope for the bean
  3. Ensure that you have added <context:component scan> in the XML configuration
  4. Ensure that <context: annotation-config/> is specified in the XML configuration

Answer(s): C






Post your Comments and Discuss SpringSource CoreSpringV3.2 exam with other Community members:

Exam Discussions & Posts