@After("@annotation(demo.MyLogAnnotation)")
时间: 2023-10-22 12:04:56 浏览: 31
@After("@annotation(demo.MyLogAnnotation)")是一个AspectJ切面注解,用于标注在一个方法上。它表示当被注解的方法执行完毕后,切面中带有@After("@annotation(demo.MyLogAnnotation)")注解的方法也会被执行,而且只有在被注解的方法上也有@MyLogAnnotation注解时才会执行。这个切面的作用是在被注解的方法执行完毕后,记录一些日志信息。其中@MyLogAnnotation是自定义的注解,用于标记需要记录日志的方法。
相关问题
参数校验异常:Failed to convert property value of type 'java.lang.String[]' to required type 'java.util.Date' for property 'transDate'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.annotation.JsonFormat @javax.persistence.Id @org.jeecgframework.poi.excel.annotation.Excel @org.springframework.format.annotation.DateTimeFormat @io.swagger.annotations.ApiModelProperty java.util.Date] for value '"2023-02-15T11:48:18.903Z"'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value ["2023-02-15T11:48:18.903Z"]<br>
这个异常是由于参数校验时,将一个类型为 'java.lang.String[]' 的属性值转换成了类型 'java.util.Date',而转换失败导致的。具体的异常信息是 'ConversionFailedException',其中的详细信息是 'Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.annotation.JsonFormat @javax.persistence.Id @org.jeecgframework.poi.excel.annotation.Excel @org.springframework.format.annotation.DateTimeFormat @io.swagger.annotations.ApiModelProperty java.util.Date] for value "2023-02-15T11:48:18.903Z"'。最后的异常信息是 'Parse attempt failed for value ["2023-02-15T11:48:18.903Z"]'。这个异常通常是由于日期格式不符合要求导致的。你可以检查一下传入的日期字符串是否符合要求的格式,或者尝试使用其他方式进行日期转换。
@Pointcut("@annotation(com.ais.dsg.common.log.annotation.SysOptLog)") public void sysLogAspect() { }什么意思
这是一个使用Spring AOP切面编程的代码片段,其中包含了@Pointcut注解。具体来说:
- @Pointcut:表示定义一个切入点,用来匹配需要被切入的方法。
- "@annotation(com.ais.dsg.common.log.annotation.SysOptLog)":表示匹配被@SysOptLog注解标注的方法。
- public void sysLogAspect() {}:表示切入点的方法名称,这个方法没有具体的实现,只是用来定义一个切入点。
因此,这段代码的意思是:定义一个切入点方法sysLogAspect(),用来匹配被@SysOptLog注解标注的方法。当我们在其他的切面中需要匹配被@SysOptLog注解标注的方法时,可以直接使用这个切入点方法,而不需要重复定义匹配规则。
需要注意的是,这里的@SysOptLog注解是自定义的注解,可能和其他项目的注解定义不同。