1. Annotation used to refer poincuts?
Correct Answer is : @Pointcut
2. what will be the output of the code snippet?
package com.apress.springrecipes.calculator;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class CalculatorPointcuts
{
@Pointcut("execution(* *.*(..))")
public void loggingOperation() {}
}
package com.apress.springrecipes.calculator;
@Aspect
public class CalculatorLoggingAspect
{
...
@Before("CalculatorPointcuts.loggingOperation()")
public void logBefore(JoinPoint joinPoint)
{
...
}
@AfterReturning(
pointcut = "loggingOperation()",
returning = "result")
public void logAfterReturning(JoinPoint joinPoint, Object result)
{
throw new IllegalArgumentException();
}
@AfterThrowing(
pointcut = "CalculatorPointcuts.loggingOperation()",
throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, IllegalArgumentException e)
{
...
}
@Around("CalculatorPointcuts.loggingOperation()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable
{
...
}
}
Correct Answer is : BeanCreation Exception
3. Language used to set various kinds of join points
Correct Answer is : AspectJ pointcut language
4. Spring AOP only supports method execution join points for the beans in its IoC container
5. Is the following pointcut expression correct?
execution(* ArithmeticCalculator.*(..))
Correct Answer is : If every target class is in same package
6. The annotations must be added to the implementation class but not the interface
7. Which of the following pattern is used to match bean name?
Correct Answer is : bean(*Calculator)
8. Bean name patterns are supported by all configurations(XML,Java,AspectJ)
Correct Answer is : FALSE
9. Expressions which returns Parameters of pointcuts?
Correct Answer is : all of the mentioned
10. Are logical operators valid in pointcut expressions?
11. Method which checks if all target classes are matched
Correct Answer is : matches()
12. Spring supports operations on pointcuts:-
Correct Answer is : all of the mentioned
13. Pointcuts can be composed using:-
Correct Answer is : all of the mentioned
14. Pointcut used to parse an AspectJ pointcut expression string
Correct Answer is : org.springframework.aop.aspectj.AspectJExpressionPointcut
15. Spring supports most of the popular ORM (or data mapper) frameworks.
16. ORM which isn’t supported by Spring:-
17. An ORM framework persists your objects according to the mapping metadata you provide.
18. Database Engine which uses low memory consumption and easy configuration.
Correct Answer is : Apache Derby
19. Mode which Derby prefers to run in:-
Correct Answer is : all of the mentioned
20. For testing purposes, the client/server mode is more appropriate.