Test Series - spring

Test Number 10/20

Q: Applying aspects to your target objects
A. AspectJ Annotation
B. Weaving
C. All of the mentioned
D. None of the mentioned
Solution: Weaving is the process of applying aspects to your target objects.
Q: Special compiler used during weaving
A. jvm
B. gcc
C. ajc
D. none of the mentioned
Solution: AspectJ compile-time weaving is done through a special AspectJ compiler called ajc.
Q: Name of the process when targe classes are loaded into JVM
A. load-time weaving
B. process-time weaving
C. load-process weaving
D. process-delivery weaving
Solution: AspectJ load-time weaving (also known as LTW) happens when the target classes are loaded into JVM by a class loader.
Q: How to weave your classes using argument while compiling?
A. -javaagent:CLASSPATH
B. -javaagent:PackgePath
C. -javaweave:CLASSPATH
D. -javaweave:PackagePath
Solution: You need only to add a VM argument to the command that runs your application. Then your classes will get woven when they are loaded into the JVM.
Q: XML Element to include load-time weaver
A. aop:config
B. aop:auto-wire
C. context:load-time-weaver
D. aop:load-time-weaver
Solution: To turn on a suitable load-time weaver for your Spring application, you need only to declare the empty XML element context:load-time-weaver.
Q: Library to use AspectJ weaver
A. spring-instrument.jar
B. spring-introduction.jar
C. spring-aop.jar
D. spring-weave.jar
Solution: To use the AspectJ weaver, you need to include the spring-instrument.jar
Q: Objects created outside the container:-
A. Domain Objects
B. User Objects
C. SpringVisitor Objects
D. None of the mentioned
Solution: Objects created outside the Spring IoC container are usually domain objects. They are often created using the new operator or from the results of database queries.
Q: How to inject Spring bean into domain objects
A. AOP
B. XML
C. AspectJ
D. Java Based
Solution: To inject a Spring bean into domain objects created outside Spring, you need the help of AOP.
Q: Which scope does @Configurable instantiated class looks for?
A. Singleton
B. Prototype
C. None of the mentioned
D. All of the mentioned
Solution: When a class with the @Configurable annotation is instantiated, the aspect will look for a prototype-scoped bean definition whose type is the same as this class.
Q: Spring includes AnnotationBeanConfigurerAspect in its aspect library for configuring the dependencies of any objects
A. True
B. False
C. 1
D. 0
Solution: Spring includes AnnotationBeanConfigurerAspect in its aspect library for configuring the dependencies of any objects, even if they were not created by the Spring IoC container. First of all, you have to annotate your object type with the @Configurable annotation to declare that this type of object is configurable.

You Have Score    /10