-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidationAscpect.java
More file actions
30 lines (24 loc) · 910 Bytes
/
Copy pathValidationAscpect.java
File metadata and controls
30 lines (24 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.jspring6.springbootrestaop.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class ValidationAscpect {
private static final Logger LOGGER = LoggerFactory.getLogger(ValidationAscpect.class);
@Around("execution(* com.jspring6.springbootrestaop.service.JobService.getJob(..)) && args(postId)")
public Object ValidateAndUpdate(ProceedingJoinPoint jp, int postId) throws Throwable
{
// check for postid
if(postId <0)
{ LOGGER.info("Post Id is negetive");
postId = -postId;
LOGGER.info("new value " +postId);
}
Object obj =jp.proceed( new Object[]{postId});
return obj;
}
}