aspectj

Upgrading AspectJ Runtime Library in Eclipse

I am trying to upgrade to a newer version of aspectjrt than the one that comes with Eclipse. I updated the version number in maven pom.xml. Eclipse doesn't seem to pick it up, it still displays the built-in version on its classpath. Which version of the library does m2eclipse uses? ...

Spring Optimistic Locking:How to retry transactional method till commit is successful

Hi, I use Spring 2.5 and Hibernate JPA implementation with Java and "container" managed Transactions. I have a "after user commit" method that updates data in background and need to be committed regardless of ConcurrencyFailureException or StaleObjectStateException exception, because it will never be shown to client. In other words, ne...

incorporating -xmlConfigured in maven

Does the maven-aspectj-plugin have an option to specify ajc's option -xmlConfigured? If not, what's the common practice for compiling aspect codes with most recent version of ajc using maven? ...

using spring aop pointcut getting error although i had added aspectjrt.jar also

Not able to solve this problem Error : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found at org.apache.catalina.core.ContainerBase.addChildInternal(Co...

How to disable AspectJ without restarting the program?

I have an application using AspectJ with load time weaving to advise various methods. I would like to put a switch in my program to disable the aspect without having to make any source code changes or having to restart the program. It needs to incur as little overhead as possible while turned off. Thanks! ...

AfterAdvice for all constructors of classes statically implementing an interface

Hi all, I want to do some authorization-checks for domain objects. This includes checks if someone is allowed to instantiate an object (depending of it's type - this check is done externally so no need to solve this). All our domain objects implement one specific interface (directly or indirectly) What I need is an advice which runs a...

Tomcat runtime aspects and jms destinations

Does anyone know if it's possible to deploy a war that could weave dynamic aspects around the method invocations of a class in a seperate deployment on the same tomcat server? I understand the security implications of this but we're looking to be able to audit our application as invasively as possible. Also is it possible at a war's de...

Spring AOP Advice on Annotated Controllers

I am trying to use AOP to do some processing after an annotated controller. Everything is running with no errors, but the advice is not being executed. Here is the controller code: @Controller public class HomeController { @RequestMapping("/home.fo") public String home(ModelMap model) { model = new ModelMap(); ...

Load time weaving in AspectJ using aop.xml

From what I understand, for load time weaving to work using an aop.xml file, it must be placed in META-INF. Is there a way to get around this and use an aop.xml (or any xml file) in any directory? Thanks. ...

AOP with Local Variable Annotations

I want to use local variable annotations to do better AOP. One idea is to implement the Future<T> concept with a proxy using an annotation. @NonBlocking ExpensiveObject exp = new ExpensiveObject(); //returns immediately, but has threaded out instantiation of the ExpensiveObject. exp.doStuff(); //okay, now it blocks until it's finishe...

How to change the buttons in a JOptionPane using AspectJ

I need to change the behavior of every JButton in an application (it's a research project). We felt that the best way to change all of the buttons using an aspect since it would keep it clean--we wouldn't have to change all 262 instances to a new type. We have run into a snag. The aspect that we have written does not modify the buttons i...

My @Around advice is not being called for all the methods in the package

Hi, I have this code below in my LoggingAspect class and i am expect this to run for my methods like gov.ssa.rome.service.impl.save() gov.ssa.rome.dao.impl.save() but it is running only one time no matter what. i don't know why. i have used autowire to wire dao to servcice layer. I really appreciate your help. what should i do to mak...

Petclinic spring-mvc example not building

I just co https://src.springframework.org/svn/spring-samples/ and tried to build petclinic. I did: mvn clean install mvn eclipse:eclipse I imported to eclipse but: The import org.aspectj cannot be resolved What are the odds that the pom.xml is wrong and I have to add the dependency myself? ...

Spring @Transaction method call by the method within the same class, does not work?

I am new to Spring Transaction. Some thing that I found really odd, probably I did understand this properly. I wanted to have a transactional around method level and I have a caller method within the same class and it seems like it does not like that, it has to be called from the separate class. I don't understand how is that possible. I...

AspectJ Advice on Spring Security ProviderManager throws exception on startup

Does anyone know why when I try to create an advice around the "doAuthentication" method of the Spring Security (v3.0) ProviderManager my application throws an exception on startup? I am autowiring an instance of my spring authentication-manager bean into a controller and when the autowire is attempted my app fails to deploy. Here is ...

How to script the "Convert to AspectJ" action when creating a new Eclipse project?

I have a command line script that creates a (mostly) ready-to-go Eclipse project for me. It uses Maven's eclipse plugin, and has some other scripted steps such as copying our code standard settings from our repo into .settings. This is very handy, since I need to spin up new projects often, from this one template. (For branch work, one-o...

Crosscut concerns in middle of methods

it's convenient for AOP (e.g. AspectJ, SpringAOP) to deal with(advise on) crosscut concerns at pointcuts around methods below, "Sandwich" code methodA { crosscut code user code A crosscut code } methodB { crosscut code user code B crosscut code } Is AOP apt to crosscut concerns overlapped to user code below? ...

Guice vs AspectJ

I was working with GUice some months ago and now when I return to it, I find I have to reread the Guice documentation and examples to understand what I did with my code. However, when I look at AspectJ it is all too intuitive. It is an intuitive extension of the Java language. I feel I can sit down and write AspectJ code immediately alr...

Spring logging by package name

I need to log many classes in some packages in a project which I can not change its source code. So I need a solution which I can specify package name, and with spring aop add logging to that package's classes without change them but I dont know how can I do that. How can I do that? ...

Pointcut matching methods with annotated parameters

I need to create an aspect with a pointcut matching a method if: it is annoted with MyAnnotationForMethod One of its parameters (can have many) is annotated with @MyAnnotationForParam (but can have other annotations as well). The aspect class look like this @Pointcut("execution(@MyAnnotationForMethod * *(..,@aspects.MyAnnotationForP...