-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hi Andrea,
I tried your solution, but for me it doesn't work. In my applicationContext.xml I added this lines:
<aop:config>
<aop:aspectj>
<!-- definitions of aspects available to the weaver, and which ones should
be used or not used -->
<aop:aspects>
<aop:aspect name="it.hf.gerapweb.spring.LoggingAspect" />
</aop:aspects>
<!-- control over the weaver itself and the types that will be woven -->
<aop:weaver options="-showWeaveInfo">
<aop:include within="it.hf.gerapweb.bind.funzioni..*" />
</aop:weaver>
</aop:aspectj>
</aop:config>
The class LoggingAspect is:
package it.hf.gerapweb.spring;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
@Aspect public class LoggingAspect {
private static Logger log = LoggerFactory.getLogger(LoggingAspect.class);
public LoggingAspect() {
log.info("Costruttore");
}
@Around("execution(* it.hf.gerapweb.bind.funzioni..*(..))")
public void invoke() {
log.info("Before");
log.info("After");
}
}
I added spring-instrument-tomcat-4.3.21.RELEASE.jar in my tomcat7 lib and in context.xml:
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"></Loader>
Thanks a lot. Nico
2 | No.2 Revision |
Hi Andrea,
I tried your solution, but for me it doesn't work. In my applicationContext.xml I added this lines:
<aop:config>
<aop:aspectj>
<!-- definitions of aspects available to the weaver, and which ones should
be used or not used -->
<aop:aspects>
<aop:aspect name="it.hf.gerapweb.spring.LoggingAspect" />
</aop:aspects>
<!-- control over the weaver itself and the types that will be woven -->
<aop:weaver options="-showWeaveInfo">
<aop:include within="it.hf.gerapweb.bind.funzioni..*" />
</aop:weaver>
</aop:aspectj>
</aop:config>
The class LoggingAspect is:
package it.hf.gerapweb.spring;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
org.slf4j.LoggerFactory;
@Aspect
public class LoggingAspect {
{
private static Logger log = LoggerFactory.getLogger(LoggingAspect.class);
public LoggingAspect() {
log.info("Costruttore");
}
@Around("execution(* it.hf.gerapweb.bind.funzioni..*(..))")
public void invoke() {
log.info("Before");
log.info("After");
}
}
}
I added spring-instrument-tomcat-4.3.21.RELEASE.jar in my tomcat7 lib and in context.xml:
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"></Loader>
Thanks a lot. Nico