adplus-dvertising
frame-decoration

Question

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 
   {
   ...
   }
}

a.

Runtime Error

b.

IllegalArgument Exception

c.

BeanCreation Exception

d.

None of the mentioned

Posted under Java Spring Framework

Answer: (c).BeanCreation Exception

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the code snippet?

Similar Questions

Discover Related MCQs

Q. Language used to set various kinds of join points

Q. Spring AOP only supports method execution join points for the beans in its IoC container

Q. The annotations must be added to the implementation class but not the interface

Q. Which of the following pattern is used to match bean name?

Q. Bean name patterns are supported by all configurations(XML,Java,AspectJ)

Q. Expressions which returns Parameters of pointcuts?

Q. Are logical operators valid in pointcut expressions?

Q. Method which checks if all target classes are matched

Q. Spring supports operations on pointcuts:-

Q. Pointcuts can be composed using:-

Q. Pointcut used to parse an AspectJ pointcut expression string

Q. Which special type of advice is used to implement an interface?

Q. Introduction advice helps in implementing multiple inheritance.

Q. In introduction advice you have to modify class to introduce new methods

Q. How does an Introduction advice do this in Spring?

Q. Annotation used to declare an introduction

Q. Target Classes can be denoted by Introduction Annotation

Q. Attribute used to specify implementation class

Q. How to keep track of the usage of your beans

Q. How to introduce counter field to original bean class?