Free CoreSpringV3.2 Exam Braindumps (page: 9)

Page 8 of 25

import com.springsource.service.*;

...
@Configuration public class AppConfig {
@Bean public ClientService clientService() {
return new ClientServiceImpl();
}
}

What is the id of the declared bean? (Select one)

  1. clientService (starting with lower-case "c")
  2. ClientService (starting with capital "C")
  3. com.springsource.service.ClientService
  4. com.springsource.service.ClientServiceImpl

Answer(s): A



public class AppConfig {

public ClientService clientService() {
return new ClientServiceImpl();
}
}

The Spring Java configuration above is NOT correct.
Why? (select one)

  1. The class should be annotated with @Configuration
  2. The method should be annotated with @Bean
  3. Both (a) and (b)
  4. Neither (a) or (b)

Answer(s): C



@Configuration public class AppConfig {
@Bean public ClientService clientService() {
ClientServiceImpl clientService = new ClientServiceImpl();
clientService.addClientDao(new ClientDao());
return clientService;
}

In the example above, which statement is NOT true with regards to Spring Java configuration?
(select one)

  1. The declared bean is a singleton by default
  2. This bean might be wrapped by a proxy
  3. This bean cannot use a method starting with "add" to inject a dependency
  4. The bean is of type ClientService

Answer(s): C



ClientService service = applicationContext.getBean(ClientService.class)

Which statement is true with regards to the above example? (select one)

  1. It returns the bean called "ClientService"
  2. It returns a bean of the type ClientService (regardless of its id or name)
  3. This syntax is not valid because the bean id must be specified as a method param
  4. This syntax is not valid because the result of the getBean method should be explicitely cast into ClientService

Answer(s): B






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

CoreSpringV3.2 Exam Discussions & Posts