नहीं मिल रहा है मैं एओपी के लिए नया हूं। मुझे इस तरह की कुछ समस्या मिली।एओपी: java.lang.IllegalArgumentException: 0 पर त्रुटि संदर्भित पॉइंटकट
package org.suman.Aspect;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class LoginAspect {
//@Before("execution(public String getName())")
//@Before("execution(public String org.suman.Model.Triangle.getName())")
//@Before("execution(* get*())")
//@Before("execution(* get*(..))")
//@Before("execution(* org.suman.Model.*.get*())")
//@Before("execution(* get*())&& within(org.suman.Model.Circle)")
@Before("execution(* get*())&& allCircle()")
//@Before("allGetters() && allCircle()")
public void LoginAdvice()
{
System.out.println("Advice run.. getMethod is called");
}
@Before("execution(* get*())")
//@Before("allGetters()")
public void SecondAdvice()
{
System.out.println("this is a second Advice");
}
@Pointcut("execution(* get*())")
public void allGetters(){}
//@Pointcut("execution (* * org.suman.Model.Circle.*(..))")
@Pointcut("within(org.suman.Model.Circle)")
public void allCircle(){}
}
जब pointcut, विधि allGetters() LoginAdvice विधि का उपयोग कर, अगर मैं @Before का उपयोग करें ("निष्पादन (* मिल *())") तो कोई त्रुटि लेकिन अगर मैं @Before ("allGetters (का उपयोग) ") तो देता त्रुटि" java.lang.IllegalArgumentException: :: 0 नहीं मिल सकता है संदर्भित pointcut allGetters
अगर मैं @Before का उपयोग पर त्रुटि ("निष्पादन (* मिल *()) & & (ऑर्ग के भीतर। suman.Model.Circle) ") विधि नाम के बजाय यह काम करता है।
मेरा xml इस तरह:
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- <context:annotation-config /> -->
<aop:aspectj-autoproxy />
<bean name="triangle" class="org.suman.Model.Triangle">
<property name="name" value="Triangle Name"></property>
</bean>
<bean name="circle" class="org.suman.Model.Circle">
<property name="name" value="Circle name"></property>
</bean>
<bean name="shapeService" class="org.suman.Services.ShapeService"
autowire="byName"></bean>
<bean name="loginAspect" class="org.suman.Aspect.LoginAspect"></bean>
</beans>
है जिसके द्वारा यह विधि
उन लोगों के लिए जो इस धागे पर आए और इस पृष्ठ पर प्रस्तावित समाधानों में से कोई भी काम नहीं किया, यहां एक नज़र डालने का प्रयास करें: https://stackoverflow.com/questions/21279716/error-at-0-cant-find-referenced -pointcut-annotation – rj2700