Test Series - spring

Test Number 9/20

Q: Which special type of advice is used to implement an interface?
A. Introduction
B. Before
C. After
D. AfterSpecial
Solution: It allows your objects to implement an interface dynamically by providing an implementation class for that interface.
Q: How does an Introduction advice do this in Spring?
A. dynamic proxy
B. web proxy
C. implements org.springframework.net.bundle interface
D. none of the mentioned
Solution: Introduction works by adding an interface to the dynamic proxy.
Q: Annotation used to declare an introduction
A. Before
B. After
C. @DeclareParents
D. None of the mentioned
Solution: In this aspect, you can declare an introduction by annotating an arbitrary field with the @DeclareParents annotation.
Q: Attribute used to specify implementation class
A. no such attribute
B. defaultImpl
C. defaultInterface
D. defaultImplement
Solution: The interface to introduce is determined by the type of the annotated field. Finally, the implementation class used for this new interface is specified in the defaultImpl attribute.
Q: How to keep track of the usage of your beans
A. Calling Count
B. Last modified date
C. New Interface to your object
D. All of the mentioned
Solution: You can introduce a new interface to your objects with an implementation class that holds the state field.
Q: How to introduce counter field to original bean class?
A. Using Spring AOP
B. Implementing interface
C. AspectJ Pointcut
D. None of the mentioned
Solution: Since there is no field for storing the counter value in the original classes, you need to introduce one with Spring AOP.
Q: Tag used to declare aspects
A. aop:config
B. aop:auto-proxy
C. aop:autowire
D. None of the mentioned
Solution: In the bean configuration file, all the Spring AOP configurations must be defined inside the aop:config element.
Q: Tag used to enable AspectJ annotation?
A. Introduction
B. aop:aspectj-autowire
C. aop:aspectj-autoproxy
D. AfterSpecial
Solution: To enable AspectJ annotation support in Spring, you have already defined an empty XML element, aop:aspectj-autoproxy.
Q: Tag which defined Spring AOP configurations
A. aop:config
B. aop:configregister
C. aop:configbeans
D. None of the mentioned
Solution: In the bean configuration file, all the Spring AOP configurations must be defined inside the aop:config element.
Q: What are the ways to declare an advice?
A. pointcut-ref attribute
B. pointcut attribute
C. all of the mentioned
D. none of the mentioned
Solution: An advice element requires either a pointcut-ref attribute to refer to a pointcut or a pointcut attribute to embed a pointcut expression directly.

You Have Score    /10