Aspectj Support And Scripting(Engineering > Computer Science And Engineering > Spring > Aop ) Questions and Answers
Question 1. How to inject Spring bean into domain objcts
AOP
XML
AspectJ
Java Based
Explanation:-
Answer: Option A. -> AOP
To inject a Spring bean into domain objects created outside Spring, you need the help of AOP.
Question 2. Special compiler used during weaving
jvm
gcc
ajc
none of the mentioned
Explanation:-
Answer: Option C. -> ajc
AspectJ compile-time weaving is done through a special AspectJ compiler called ajc.
Question 3. Which advice is executed only when joint point returns or throws an exception?
@Before
@After
@AfterReturning
@AfterThrowing
Explanation:-
Answer: Option C. -> @AfterReturning
If you would like to perform logging only when a join point returns, you should replace the after advice with an after returning advice.
Question 4. Which of the following is advice supported by Aspect Annotation?
@Before
@After
@AfterReturning
All of the mentioned
Explanation:-
Answer: Option D. -> All of the mentioned
AspectJ supports five types of advice annotations: @Before, @After, @AfterReturning, @AfterThrowing, and @Around.
Question 5. Lightweight java scripting language executing java fragments
JRuby
Groovy
BeanShell
All of the mentioned
Explanation:-
Answer: Option C. -> BeanShell
BeanShell is a lightweight Java scripting language that can dynamically execute Java code fragments while supporting scripting features like those of other scripting languages.
Question 6. Is the following pointcut expression correct?execution(* ArithmeticCalculator.*(..))
Yes
No
If every target class is in same package
Depends where target class is located
Explanation:-
Answer: Option C. -> If every target class is in same package
You can omit the package name if the target class or interface is located in the same package as this aspect.
Question 7. Dynamic-language-backed bean with some configurations
Refreshable bean
Beanshell
Scripting Beans
Inline Script
Explanation:-
Answer: Option A. -> Refreshable bean
Question 8. XML element to specify the property values for scripting bean
lang:property
bean:property
script:property
None of the mentioned
Explanation:-
Answer: Option A. -> lang:property
You can specify the property values for a scripting bean in the lang:property elements.
Question 9. Annotation used to declare an introduction
Before
After
@DeclareParents
None of the mentioned
Explanation:-
Answer: Option C. -> @DeclareParents
In this aspect, you can declare an introduction by annotating an arbitrary field with the @DeclareParents annotation.