pointcut

Spring AOP ignores some methods of Hessian Service

江枫思渺然 提交于 2019-12-24 03:29:23
问题 I have an Aspect with the following pointcut definition @Pointcut("execution(public de.company.project..* *(..))") and a spring configuration containing the following <aop:aspectj-autoproxy /> <bean id="myaspect" class="de.company.project.impl.MyAspect" /> <bean id="someService" class="de.company.project.impl.SomeService" /> <bean name="/SomeService" class="org.springframework.remoting.caucho.HessianServiceExporter"> <property name="service" ref="someService" /> <property name=

How to intercept proceed() in another AspectJ aspect?

試著忘記壹切 提交于 2019-12-23 06:13:11
问题 I have a situation as follows: I have a LoggingAspect with several pointcuts matching specific method executions in my main application. The corresponding advice bodies basically all look similar, causing a lot of code duplication: void around() : download() { String message = "Downloading, verifying (MD5) and unpacking"; SimpleLogger.verbose(message, IndentMode.INDENT_AFTER); proceed(); SimpleLogger.verbose(message + " - done", IndentMode.DEDENT_BEFORE); } There is some variation, though.

AspectJ pointcut for constructor using java.lang.reflection

↘锁芯ラ 提交于 2019-12-23 01:13:38
问题 The following example is a reduction of the real problem in that it tries to simplify is as much as possible. I have a java interface, and several objects that implement that interface, like: public interface Shape{ public void draw(); public void erase(); public boolean isDrawn(); } public class Square implements Shape{ @Override public void draw(){ //TODO: method implementation } @Override public void erase(){ //TODO: method implementation } Override public boolean isDrawn(){ //TODO: method

AspectJ pointcut for constructor using java.lang.reflection

可紊 提交于 2019-12-23 01:13:11
问题 The following example is a reduction of the real problem in that it tries to simplify is as much as possible. I have a java interface, and several objects that implement that interface, like: public interface Shape{ public void draw(); public void erase(); public boolean isDrawn(); } public class Square implements Shape{ @Override public void draw(){ //TODO: method implementation } @Override public void erase(){ //TODO: method implementation } Override public boolean isDrawn(){ //TODO: method

Getting a return value or exception from AspectJ?

半城伤御伤魂 提交于 2019-12-21 07:07:54
问题 I am able to get the signature and arguments from advised method calls, but I cannot figure out how to get the return values or exceptions. I'm kind of assuming that it can be done in some way using around and proceed. 回答1: You can use after() returning and after() throwing advices as in beginning of the following document. If you're using @AspectJ syntax please refer to @AfterReturning and @AfterThrowing annotations (you can find samples here). 回答2: You can also get return value using after

AspectJ/Java instrumentation to intercept an annoted parameter call/usage

夙愿已清 提交于 2019-12-13 04:57:08
问题 I would like to know how the doMonitorization method can be called when the param1 is used (param defined and used on the methods of the TestClassGeneralMeasuraments Class) which has the correct annotation that has a interception AspectJ definition as the bellow code shows. package monitorization; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; @Aspect public class

Get the value of the accessed field within a get pointcut

痞子三分冷 提交于 2019-12-13 04:49:10
问题 I have a pointcut which listens to access to an field in DBRow and all subclasses before(DBRow targ) throws DBException: get(@InDB * DBRow+.*) && target(targ) { targ.load(); } I now need to determine the value of the accesed field, that is specified by the get pointcut. Is this possible in AspectJ? 回答1: For set() pointcuts you can bind the value via args() , but not for get() pointcuts. So in order to get the value without any hacky reflection tricks, just use an around() advice instead of

ReentrantReadWriteLock with AspectJ pointcut for every initialized type of MyStructure

徘徊边缘 提交于 2019-12-13 03:41:46
问题 I am struggling to create a ReentrantReadWriteLock with AspectJ for every single object that is constructed and is a type of Mystructure. Here is my source code. The aspect class import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; @Aspect

Pointcut confusion with inheritance

房东的猫 提交于 2019-12-13 03:37:13
问题 I am confused by writing a pointcut that matches all executions of a method. I tried the pointcut that should match all method-executions of class Alpha : execution(* Alpha.*(..)) with the following class-hierachy public class Alpha { public void alphaMethod() {...} } public class Beta extends Alpha { public void betaMethod() { alphaMethod(); } } If the Main-program calls alphaMethod on an Beta -instance my advice is called like expected but the Main-program calls betaMethod that also calls

Aspect on super interface method implemented in abstract super class

冷暖自知 提交于 2019-12-13 02:59:44
问题 I have a problem quite similar to: How to create an aspect on an Interface Method that extends from A "Super" Interface, but my save method is in an abstract super class. The structure is as follows - Interfaces: public interface SuperServiceInterface { ReturnObj save(ParamObj); } public interface ServiceInterface extends SuperServiceInterface { ... } Implementations: public abstract class SuperServiceImpl implements SuperServiceInterface { public ReturnObj save(ParamObj) { ... } } public