spring Aop @args() 导致启动报错
@Target({ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface PropNotNull { String[] propNames() default {}; }
@Component @Aspect public class ParameterVerify { @Autowired private ObjUtil objUtil; @Around(value = "@args(com.example.obj.obj_manager.parameter_verify.prop_not_null.PropNotNull)")//环绕切面 public Object before(ProceedingJoinPoint pjp) throws Throwable { System.out.println(1111); Object ret = pjp.proceed(); return ret; } }
java.lang.NullPointerException: null at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:240) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:106) ~[tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4516) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) [tomcat-embed-core-9.0.16.jar:9.0.16] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) [tomcat-embed-core-9.0.16.jar:9.0.16] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_172]
将切点表达式中的:@args()换成@annotation就不会报错了,能正常启动了。
请教各位前辈,是什么原因导致idea启动不了项目的?是不是@args这个表达式有问题?
梦里花落0921
相关分类