aspects

How can I apply an aspect using annotations in Spring?

Update: I've found the Spring 2.x annotation-based Controllers are horrible for AOP security because you can't make assumptions about the method prototype due to the increased freedom in params and return values. Before 2.x you could intercept handleRequest and know the first param was an HttpServletRequest and the return value was a Mod...

Future of Aspect Oriented Programming

I am a newbie in the area of AOP. The first time I coded something applying concepts of AOP, I was thrilled to understand how aspects eliminate cross cutting patterns in your application. I was overwhelmed by the thought of solving cross cutting patterns like security, logging, transactions, auditing and etc applying AOP. However, when ...

Is AspectF (a Fluent Aspect Framework) an AOP-like design that can be used without much concern?

Omar Al Zabir is looking for "a simpler way to do AOP style coding". He created a framework called AspectF, which is "a fluent and simple way to add Aspects to your code". It is not true AOP, because it doesn't do any compile time or runtime weaving, but does it accomplish the same goals as AOP? Here's an example of AspectF usage: ...

Polymorphism in AspectJ

I am trying to decide which is the better way to dispatch on a type in AspectJ. Suppose I am performing a computation on a tree with three kinds of nodes. I could then write a simple Java method: private void computation(TreeNode node) { if (node instanceof Node0) { // Do stuff. } else if (node instanceof Node0) { ...

How do you globally modify page output sent from IIS without modifying the page source?

A couple sites of mine recently got "hacked". Someone was able to add a line of JavaScript to the bottom of every page on the site. The server is a Windows Server 2003, and has Cold Fusion 8 and MySQL 5.x installed and running. Looking into the code on each page shows that none of the pages were modified. The JavaScript is not in the ...

Any PostSharp alternative?

I have to abandon using PostSharp, because it won't work with obfuscated/merged assemblies. At least, I don't see any way to get it working (it crashes on app start, when assemblies are obfuscated) I need to intercept some methods in my app (call special code instead of original methods - OnMethodInvocationAspect) Any advice? ...

Avoiding Aspects While Debugging in Eclipse

I am working on the big project with a number of aspects defined on business classes. I would like to avoid entering the aspect's code while debugging a code in business classes. Is there any solution for that? We are using compile time weaving and maven for compiling. ...

How do you use stereotype annotations in Spring 2.5.x?

When moving to Spring 2.5.x I found that it adds more stereotype annotations (on top of @Repository from 2.0): @Component, @Service and @Controller. How do you use them? Do you rely on implicit Spring support or you define custom stereotype specific functions/aspects/features? Or is it predominately for marking beans (compile time, conce...

Autocompletion in Eclipse for Roo project

Hi guys, I've got a Roo project where I've made a couple of entities, and when I load up the project in Eclipse it loads up fine, but if I i.e. make an instance MyEntity entity and then write entity. I don't get any of my properties (i.e. getMyField) in the autocompletion list. If I write entity.getMyField() it compiles fine, that is ta...

PostSharp on assemblies I don't have source for

In the examples on their website, PostSharp has a demo of intercepting calls in main system assemblies. I have tried a few times to setup and replicate said intercept calls on assemblies I don't have the source code for with no success. My approach was to simply place the assembly level attribute targeting the namespace and method I wa...

Spring AOP injecting PortletRequest

Hi there, I'm trying to inject a portletrequest in my aspect class @Autowired(required = true) private PortletRequest request; @Before("execution(* de.ac.mis.dao.*.getSessionFactory())") public void setUsername() { System.out.println("Now I'm setting the username " + this.request); } Only gives me an Caused by: org.springframew...

Apply Alfresco aspect with custom properties during the creation of document

I tried to create cmis:document and apply custom aspect on it. At that time I wanted to set some aspect properties: <cmisra:object> <cmis:properties> <cmis:propertyId propertyDefinitionId="cmis:objectTypeId"> <cmis:value>cmis:document</cmis:value> </cmis:propertyId> <alf:setAspects> ...

Interceptors vs aspect in spring?

hello all, am trying to use interceptors in spring, i want to implement an interceptor on some methods, to handle specific logic when these methods called, i want also to be apart from using web framework, as am tending to use spring as back end, without any headers, after searching i think spring approach is called Aspects, could you ...

Aspectj. Creating innter type methods in multiple classes

Hello there! If I put: public CountryState CountryState.find(long id) { return (CountryState) findById(CountryState.class, id); } I'm creating a method find in the class CountryState. Is there a way to create a method in several classes? Do I need to repeat the code for each class I want to create? I know that with aspect I...

C# AOP Method Interception on child method calls?

My AOP (C#) implementation always intercepts the first (public) method call but not subsequent methods called within the first intercepted method, is this a limitation with ContextBoundObject AOP implementations or am I doing it wrong? [InterceptMe] public void MethodOne() { MethodTwo(); } [InterceptMe] public void MethodTwo() { ...

Scala and Aspects

Scala and Aspects can be used together? Are there benefits in this case? Thanks ...