aspectj

Android Annotations and MonkeyTalk?

依然范特西╮ 提交于 2019-12-12 13:07:08
问题 I just tried to update my project which uses Android Annotations to include the MonkeyTalk agent. However, as soon as I switch the project to an AspectJ project, all my Android Annotations references are not recognized. Has anybody successfully used MonkeyTalk in an Android Annotations project? I'm using Eclipse 4.2 SR2. It looks like this issue has been raised on the Android Annotations FAQ: https://github.com/excilys/androidannotations/wiki/FAQ#wiki-aspectj In order to "fix" it, you have to

AspectJ: @AfterReturning

[亡魂溺海] 提交于 2019-12-12 12:04:53
问题 I've created this pointcut: @Pointcut("execution(* com.living.commty.boot.resources.*.* (..))") public void resourcesCut() {} I'm trying to get the return value after having been returned: @AfterReturning(pointcut="resourcesCut()", returning="result") public void afterReturning(JoinPoint joinPoint, Object result) { //... } The problem is that it's cutting only 6 advises. However, if I not set returning : @AfterReturning(pointcut="resourcesCut()") public void afterReturning(JoinPoint joinPoint

Spring AOP AspectJ切入点表达式的例子

廉价感情. 提交于 2019-12-12 11:37:17
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1)匹配方法签名模式 最典型的切入点表达式用于匹配的方法签名。 匹配一个类中的所有方法在另一个包 例如,下面的切入点表达式匹配中声明的所有方法 EmployeeManager 接口。 前面的通配符匹配方法与任何修饰符(public, protected, and private )和任何返回类型。 两个点的参数列表匹配任意数量的参数。 execution(* com.howtodoinjava.EmployeeManager.*(..)) 匹配一个类中的所有方法在同一个包内 如果目标类或接口位于同一个包内你可以省略的包名称。 execution(* EmployeeManager.*(..)) EmployeeManager匹配所有公共方法 在开始使用公共关键字,使用*匹配任何返回类型。 execution(public * EmployeeManager.*(..)) 匹配所有公共方法与返回类型EmployeeDTO EmployeeManager 在开始使用公共关键字和返回类型。 execution(public EmployeeDTO EmployeeManager.*(..)) 匹配所有公共方法和返回类型EmployeeDTO EmployeeManager EmployeeDTO第一个参数

aspectj and spring with aspectj-autoproxy

核能气质少年 提交于 2019-12-12 10:44:52
问题 I've declared my aspects using the @Aspect annotation, but the advice does not seem to get applied. The aspect works in a few other projects that I have, and the key difference seems to be that the other projects are completely wired using annotations, and this particular project is xml wired. The only bean that is annotation wired is the Aspect. So I'm wondering if spring's aspectj support, when using aspectj-autoproxy is sensitive to order that the beans are defined in the xml. For example,

How to intercept method which handles its own exceptions using AspectJ

雨燕双飞 提交于 2019-12-12 09:09:02
问题 I'm trying add some monitoring when some specific exception occurs. For example, if I have an aspect like this: @Aspect public class LogAspect { @AfterThrowing(value = "execution(* *(..))", throwing = "e") public void log(JoinPoint joinPoint, Throwable e){ System.out.println("Some logging stuff"); } } And test class: public class Example { public void divideByZeroWithCatch(){ try{ int a = 5/0; } catch (ArithmeticException e){ System.out.println("Can not divide by zero"); } } public void

AspectJ load time weaving not working on Spring beans

て烟熏妆下的殇ゞ 提交于 2019-12-12 08:47:04
问题 I'm working on a project that uses the Java (not xml) flavour of Spring configuration for wiring up dependencies. It also has profiling logic that should be weaved via AspectJ onto the desired methods (via annotations). The setup is working and I can see classes from my desired package being weaved and profiling information being logged out of them. The problem is that weaving does not work for @Bean classes. I've enabled debug in aop.xml via: <weaver options="-XnoInline -Xreweavable -verbose

Injection Error NullPointerException for AspectJ Annotation Class Java

旧巷老猫 提交于 2019-12-12 06:10:02
问题 I'm trying to inject a class called MeasurementService into an AspectJ Annotation class called MeasurementAspect but I received an error of NullPointerException and I checked that the injection of MeasurementService is null in this case. The injected class itself is then triggered in one of the advices . The MeasurementAspect class itself doesn't have constructor as I think there is no need to have it and all advice will be injected to the appropriate methods and executed automatically. Here

gradle-aspectj: Weaving & ajc compiler options working in compile but not in test task

感情迁移 提交于 2019-12-12 05:01:35
问题 I have set up weaving successfully in Eclipse via the AJDT plugin and in my gradle build via the gradle-aspectj plugin (which took quite some time...). In Eclipse this works both for production and test code, i.e. all tests pass. When I run the gradle build, the resulting app also works fine and I can see that aspects are working as expected. The gradle "test" task however fails as many tests fail. I can track most of the failures back to some aspect (here: for spring transactions) not

how capture the main method trace from jade using AspectJ?

空扰寡人 提交于 2019-12-12 04:54:52
问题 i am using Jade in eclipse IDE, i want to capture the main method from jade, because the main method is the starting point for every application, i want to test if it is also right with the running of the JADE middleware (ie: i want to check if the main method is executed when i start the jade middleware or not) i already did this : public aspect MainAspect { pointcut main() : execution(public static void main(..)); before() : main(){ System.out.println("main is executed"); } } but it is not

where to code ThreadLocal.remove() in aspectj class

旧时模样 提交于 2019-12-12 04:53:29
问题 /* We are using Aspect to do AOP on some existing application and we also used threadlocal to store GUId. we are using @Around annotation. At the start of the transaction we are setting the GUID in transaction with initialValue() method. Issue is as we know when we are using threadlocal we should also take care about removing the data from threadlocal otherwise it may result i outofmemory execption. if i am removing it at the last of the aspect it is corrupting the code and changing the UUID