code: public static Optional<LoggingAspectConfig> getConfigAnnotation(JoinPoint joinPoint) {
  
          Optional<Method> method = getCallingMethod(joinPoint);
  
          Optional<LoggingAspectConfig> result = method
              .map(m -> AnnotationUtils.findAnnotation(m, LoggingAspectConfig.class));
  
          if (!result.isPresent()) {
              Optional<Class> clazz = getDeclaringClass(joinPoint);
              result = clazz.map(aClass -> AnnotationUtils.getAnnotation(aClass, LoggingAspectConfig.class));
          }
  
          return result;
      }
docs: Find annotation related to method intercepted by joinPoint.
  
  Annotation is searched on method level at first and then if not found on class lever as well.
  
  Method uses spring {@link AnnotationUtils} findAnnotation(), so it is search for annotation by class hierarchy.
  
  @param joinPoint join point
  @return Optional value of type @{@link LoggingAspectConfig}
  @see AnnotationUtils