Spring AOP aspectj aspect proxy cglib

no cglib:
Java: class Finder implement FinderIFace with find method

pom.xml
osgi import:
org.springframework.aop,
org.springframework.aop.framework,
org.aopalliance.aop,

add MetricsPopulatingAspect to spring beans in spring config xml

dependencies:

org.springframework
spring-aop

org.springframework
spring-aspects

I used old spring 2.5.6

java:
@Aspect
public class MetricsPopulatingAspect {

private static final Logger LOGGER = LoggerFactory.getLogger(MetricsPopulatingAspect.class);

@AfterReturning(value = “execution(* com.bawi.Finder.find(..))”, returning = “retVal”)
public void populate(Object retVal) {

LOGGER.debug(“Intercepting call to {}”, Finder.class.getName());

if (!(retVal instanceof …)) {

CGLIB approach:
pom
extra:
org.springframework.aop.aspectj,
org.springframework.aop.aspectj.annotation,
net.sf.cglib.proxy,
net.sf.cglib.core,
net.sf.cglib.reflect,

extra dependencz
net.sourceforge.cglib
com.springsource.net.sf.cglib
2.1.3

Same java code for aspect but class Finder does not implement interface

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s