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)

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)
A . Ensure that you specify a valid bean name in the @Component annotation
B . Ensure that you specify a valid @Scope for the bean
C . Ensure that you have added <context:component scan> in the XML configuration
D . Ensure that <context: annotation-config/> is specified in the XML configuration

Answer: C

Which of the following statements about the @PostConstruct annotation is NOT true? (select one)

Which of the following statements about the @PostConstruct annotation is NOT true? (select one)
A . It is a JSR-250 standard Java annotation
B . There are no restrictions on method name or visibility of a method which can be annotated with @PostConstruct
C . It can be enabled using the <context:annotation-config /> tag
D . It is called before setter injection

Answer: D

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

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

(select one)

@Configuration

public class AppConfig {

@Bean

public ClientService clientService() {

ClientServiceImpl clientService = new ClientServiceImpl();

clientService.addClientDao(new ClientDao());

return clientService;

}
A . The declared bean is a singleton by default
B . This bean might be wrapped by a proxy
C . This bean cannot use a method starting with "add" to inject a dependency
D . The bean is of type ClientService

Answer: C

Which of the following statements about the FactoryBean interface is NOT true? (select one)

Which of the following statements about the FactoryBean interface is NOT true? (select one)
A . A FactoryBean can be used to generate Spring beans of any type
B . The Spring configuration <property name="someValue" ref="myFactoryBeanImpl"/> will ALWAYS inject the instance of the FactoryBean implementation
C . FactoryBean is a Spring interface
D . Factory objects used in Spring do not necessarily have to implement the FactoryBean interface

Answer: B

Which statement is true about the two references returned?

Two beans of type MyBean are defined in the ApplicationContext with singleton scope, with ids "myBean1" and "myBean2". The getBean() method is called once for each bean.

Which statement is true about the two references returned? (Select one)
A . The two references refer to different instances of the same type
B . Both references refer to the same bean instance
C . One of the references will be null
D . A RuntimeException will be thrown when the ApplicationContext is initialized

Answer: A

Identify the correct statement about the following pointcut expression. Assume that these 2 classes do not inherit from one another:

Identify the correct statement about the following pointcut expression. Assume that these 2 classes do not inherit from one another:

Execution (* rewards.service.MyClass.*(..)) && execution(* rewards.service2.MyOtherClass.*(..))

(Select one)
A . Executions of all public method calls in MyClass and MyOtherClass will be selected by this pointcut
B . Public methods in MyClass and MyOtherClass which take zero arguments will not be selected by this pointcut
C . Public methods in MyClass and MyOtherClass which take more than one argument will not be selected by this pointcut
D . This pointcut will never select any join points

Answer: D

Select which statement is true with respect to constructor injection with Spring (select one)

Select which statement is true with respect to constructor injection with Spring (select one)
A . Multiple parameters can be dependency injected into a constructor
B . Using XML configuration, the constructor-arg element may be omitted if the constructor requires a single parameter
C . One single bean cannot mix constructor injection with setter injection
D . All of the above

Answer: A