I have a problem with the <aop:aspectj-autoproxy/>
configuration tag.
I have added aspectjrt.jar and aspectjweaver.jar, but my setup still is not working.
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.9</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.1</version>
</dependency>
org.springframework.context.support.AbstractApplicationContext refresh
WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ser' defined in file \[C:\\Users\\kunar\\eclipse-workspace\\Spring\\AopProj1\\target\\classes\\com\\krk\\service\\ServiceTest.class\]: BeanPostProcessor before instantiation of bean failed
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ser' defined in file \[C:\\Users\\kunar\\eclipse-workspace\\Spring\\AopProj1\\target\\classes\\com\\krk\\service\\ServiceTest.class\]: BeanPostProcessor before instantiation of bean failed
Caused by: java.lang.IllegalStateException: Per-clause not recognized: pmAspect
at org.aspectj.internal.lang.reflect.AjTypeImpl.getPerClause(AjTypeImpl.java:183)
at org.springframework.aop.aspectj.annotation.AspectMetadata.\<init\>(AspectMetadata.java:103)
@Component
@Aspect("pmAspect")
public class AspectTest {
@Around(value = "execution(int com.krk.service.ServiceTest.a*(..))")
public Object around(ProceedingJoinPoint php) throws Throwable {
System.out.println("before method call");
Object ob=php.proceed();
System.out.println("after method call");
return ob;
}
}