Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. @Aspect
  2. public aspect RestRequestsAspect {
  3.  
  4. @Inject @LoggerAnnotation private Logger logger;
  5.  
  6. @Before("execution(* com.living.commty.rest.endpoints.interfaces.*.* (..))")
  7. public void beforeCall () {
  8. logger.info(" - INFO TEST BEFORE - ");
  9. }
  10.  
  11. @After("execution(* com.living.commty.rest.endpoints.interfaces.*.* (..))")
  12. public void afterCall () {
  13. logger.info(" - INFO TEST AFTER - ");
  14. }
  15. }
  16.  
  17. public class LoggerProducer {
  18.  
  19. @Produces @LoggerAnnotation
  20. public Logger produceLogger(InjectionPoint injectionPoint) {
  21. return LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
  22. }
  23. }
  24.  
  25. @Qualifier
  26. @Retention(RetentionPolicy.RUNTIME)
  27. @Inherited
  28. @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
  29. public @interface LoggerAnnotation { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement