Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Aspect
- public aspect RestRequestsAspect {
- @Inject @LoggerAnnotation private Logger logger;
- @Before("execution(* com.living.commty.rest.endpoints.interfaces.*.* (..))")
- public void beforeCall () {
- logger.info(" - INFO TEST BEFORE - ");
- }
- @After("execution(* com.living.commty.rest.endpoints.interfaces.*.* (..))")
- public void afterCall () {
- logger.info(" - INFO TEST AFTER - ");
- }
- }
- public class LoggerProducer {
- @Produces @LoggerAnnotation
- public Logger produceLogger(InjectionPoint injectionPoint) {
- return LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
- }
- }
- @Qualifier
- @Retention(RetentionPolicy.RUNTIME)
- @Inherited
- @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
- public @interface LoggerAnnotation { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement