aspectj

aspectj-maven-plugin not weaving if sourceDirectory is set?

青春壹個敷衍的年華 提交于 2019-12-11 02:38:34
问题 Question I have trouble weaving some aspects during compile time since I added the sourceDirectory tag with "src/main/java" as path. Before "." was set. Now the aspects are not weaved into the classes. ... <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>1.6.7</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.7</version> </dependency> ... <build> <sourceDirectory>src/main/java<

<task:annotation-driven mode=“aspectj” /> no longer possible in Spring 3.1

依然范特西╮ 提交于 2019-12-11 02:36:51
问题 Why was the attribute mode removed from Spring 3.1 task xsd? It's there in 3.0 version, and also the code in Spring 3.1 classes still check for the attribute and activate AspectJ mode is found. 回答1: Interesting! Could be just a bug - the reason I am speculating this to be a bug is because it is still possible to select the mode via @Configuration using @EnableAsync(mode=AdviceMode.ASPECTJ) This answers a part of your question, about why the check for mode is still there in the code - because

Spring Annotation driver Transaction with AspectJ problem

若如初见. 提交于 2019-12-11 02:23:01
问题 i am using AspectJ compile time weaving and spring 3.O. and Hibernate 3.0...AspectJ weaving is working fine for simple things like logging but this is not working correctly for Transaction <tx:annotation-driven transaction-manager="transactionManager" mode="aspectj" order="1" /> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> Sprong-aspects jar is also

Can't add execution pointcuts to external jar classes with AspectJ. Why?

陌路散爱 提交于 2019-12-11 02:18:57
问题 I am having some trouble trying to detect when SWT's Shell.setText() is being executed. I created two simple pointcuts, and while one works, the other does not: From my understanding, this happens because AspectJ is not detecting the SWT library in it's classpath or something. Ideally I'd want to use Load-Time-Weaving, so I added to Eclipse's LTW-Classpath the following Jar file: org.eclipse.swt.win32.win32.x86_64_3.102.0.v20130311-2025.jar which I found in the set of "Referenced Libraries"

Read Aspectj Pointcut definition from property file for LTW

淺唱寂寞╮ 提交于 2019-12-11 02:09:50
问题 I using aspectj LTW in my guice application and I m trying to make the pointcut definition for the aspects controlled from a configuration file. for example: pointcut publicOperation() : execution(*** READ THIS FROM CONFIG/PROPERTY FILE ****); Object around() : publicOperation() { ..... } what all possible options that I have ? Thanks 回答1: Put your pointcut definitions into aop.xml as suggested by the The AspectJ Development Environment Guide. 来源: https://stackoverflow.com/questions/18130336

How to set “-aspectpath” for the FreeFair AspectJ Gradle Plugin?

血红的双手。 提交于 2019-12-11 02:08:50
问题 I am trying to use an AspectJ Annotation that is in a Library, that I am pulling into my project. My project uses Gradle, so I am attempting to use FreeFair AspectJ Gradle Plugin. I need to be able to set the AspectJ -aspectpath argument, to the Library Dependency that Gradle is pulling in. FreeFair, does not seem to have much Documentation, mainly just Sample Code. In their sample code, I see that I can use this to set the -aspectpath to a local "project": aspect project(":aspectj:aspect")

Method with @Loggable annotation never prints aspect log

白昼怎懂夜的黑 提交于 2019-12-11 01:46:32
问题 I want to implement the ability to log entry and exit of some methods that are annotated with some annotation (For example: @Loggable ). I came across AspectJ AOP using which we can do this. I implemented a custom aspect of my own to customise the log message I want to print on entry and exit of the method that gets called with @Loggable : @Aspect public final class MethodLogger { private static final Logger LOG = LoggerFactory.getLogger(MethodLogger.class); @Around("execution(* *(..)) &&

AspectJ does not work on Spring @Controller methods

我与影子孤独终老i 提交于 2019-12-11 01:35:30
问题 I tryed to do aspectj-based security for controllers, but when i try to use my annotation - it's does not work. but when i try to annotate deeper service methods - all works perfectly. Controller Class @Controller public class HomeController { @Autowired private AccountService accountService; @Loggable @RequestMapping(value = "/", method = RequestMethod.GET) public String index(Principal principal, HttpSession session) { Authentication authentication = SecurityContextHolder.getContext()

How to remove java..* calls while using cflow() in aspectj?

限于喜欢 提交于 2019-12-10 20:47:16
问题 I have captured my problem in the following sample code. HelloWorld class is my source which needs to be instrumented by HelloWorldTracer aspect. My objective is to find all the method calls which are in the control flow of HelloWorld.main() . But I'm not interested in the method calls related to any types in the package java.lang.* (eg: java.lang.StringBuilder ). package com.abc; public class HelloWorld { public static void main(String args[]) { StringBuilder str = new StringBuilder(); str

Can't find referenced pointcut

风格不统一 提交于 2019-12-10 17:17:14
问题 I'm developing my first aspect and I'm encountering the following trouble. MyAspect class: @Component @Aspect public class MyAspect{ @Pointcut("execution(* com.mypackage.MyClass.method(..))") public void sendComunication(){} @AfterReturning("sendComunication()") public void sendComunicationMail() { //TODO somethings } } Then i added "aop:aspectj-autoproxy" and aop namespace in the applicationContext. Now when i try to build my application, i get this error: Caused by: org.springframework