aop

Unit Testing and PostSharp

I'm wondering what the best way to do this is... I'm interested in introducing PostSharp into one of my projects, but I'm not sure how to unit test classes marked with an attribute properly. For example: public class hello { [MyAspectThatDoesSomethingToTheDatabaseWhenThisMethodGetsCalled] public int omg(string lol) { /...

Do aspects substitute repositories?

I started experimenting with Spring Roo just recently. It does a very nice job helping one build a domain model with integrated persistence rather quickly. As it adds persistence functionality in aspects, I started think about the following question: Roo adds finders (load an instance of a class from the database which meets variable cr...

Spring AOP Pointcut syntax for AND, OR and NOT

I'm having trouble with a pointcut definition in Spring (version 2.5.6). I'm trying to intercept all method calls to a class, except for a given method (someMethod in the example below). <aop:config> <aop:advisor pointcut="execution(* x.y.z.ClassName.*(..)) AND NOT execution(* x.y.x.ClassName.someMethod(....

How can Domain driven design be combined with aspect oriented programming?

I'm doing research and one point I want to cover is "What is the relationship between Domain-driven Design and Aspect oriented programming?" I know that a main principle in DDD is separation of concerns and I understand that. What I'm not really certain is, whether aspects in AOP acts like "sub domains" in our domain in DDD. Are these...

Are all methods proxied when using Spring AOP?

When using Spring AOP to create a proxy for a class using NameMatchMethodPointcutAdvisor and BeanNameAutoProxyCreator does this essentially proxy every call to the object, but only apply the advice to the matched methods, or somehow create a Proxied object that only has those methods and uses the normal object for the calls that are supp...

Active Flash/Flex/ActionScript 3 AOP project?

I've seen the Loom project, but are there any alternatives that are more mature (and actively developed)? I am looking for something that would allow load-time weaving of pointcuts into existing binary code at runtime with the AVM2 runtime. Has any work been done in this area? ...

Caste Dynamic Proxy in Windsor Container

Hi, I've got a bit of a problem. I'm working in the Caste Windsor IOC Container. Now what i wanted to do is just mess about with some AOP principles and what i specifically want to do is based on a method name perform some logging. I have been looking at Interceptors and at the moment i am using the IInterceptor interface implemented ...

Where is aspect-oriented programming?

Some time ago AOP was going to be "the next big thing". I wonder if it has gained enough traction in big projects or if it is still in the world of ideas. What do you think? ...

Usage question: Spring AOP vs. AspectJ weaving

I am working on profiling a legacy application using Spring AOP and I want to get some data points around a decision I need to make. This is what I have done so far: I have created the code and configuration using Spring AOP which would help me to profile the beans that are being managed by the Spring container. While profiling the dao...

How can I dynamically inject code into event handlers in Delphi?

For debugging / performance tests I would like to dynamically add logging code to all event handlers of components of a given type at run time. For example, for all Datasets in a Datamodule, I need to run code in the BeforeOpen and AfterOpen events to capture the start time, and to log the elapsed time in AfterOpen. I would prefer to d...

How to configure RetryAdvice and ExceptionTranslation for Deadlocks using NHibernate and Spring

Hi, i am using Spring.net 1.2 with NHibernate 2.0.1. Within my project i'am facing some Deadlock issues and besides the database tweaks to minimize the occurence i would like to implement Springs RetryAdvice to handle this. I can't find any working example how to configure a this. The reference seems to be clear about how to use it but ...

How to create an aspect on class, that is not a bean using Spring AOP?

Hello, I work on an legacy application, where Spring AOP (namely ProxyFactoryBean) is used. I need to add an aspect around a method of a certain class. This class is not a bean however. The AspecjJ pointcut expression would be like this: execution(* xyz.package.Class.method()) I created a MethodInterceptor and AspectJExpressionPoin...

Can Spring.Net function as PostSharp?

A few months back I've discovered PostSharp, and for a time, it was good. But then legal came back with an answer saying that they don't like the licence of the old versions. Then the department told me that 2.0's price was unacceptably high (for the number of seats we need)... I was extremely disapponted, but not disheartened. Can't be...

How to use InterfaceInterceptor with NServiceBus UnityBuilder

I have a MessageHandler with a dependency declared as: public IRepository<Person> PersonRepository {get;set;} I set up my Unity container with: IUnityContainer container = new UnityContainer(); container.AddNewExtension<Interception>(); container.RegisterType(typeof(IRepository<Person>), typeof(Example.Data.InMemory.Repository<Perso...

LOG4j Spring AOP

Hi. I have a j2ee web application running on Spring framework. I want to implement logging using log4j and Spring's AOP. I was trying to find for references but I only get references which does not use log4j. I had exactly the same configuration as what was on the link you gave. I have declared too a bean which where I want to implement...

Reading annotation property in aspect

How to read annotation property value in aspect? I want my Around advice to be executed for all joint points annotated with @Transactional(readonly=false). @Around("execution(* com.mycompany.services.*.*(..)) " + "&& @annotation(org.springframework.transaction.annotation.Transactional)") public Object myMethod(ProceedingJoinPoint pjp) ...

Spring Transaction Manager

Hi. I have a j2ee application running on spring framework. I am implementing a transaction manager with AOP. It works fine. When an exception occurs in my method it is detected by my AOP configuration and rolls back the changes in the DB. But the problem is the code where you expect the error should not be surrounded with try-catch. When...

Exclude LOG4J Database Logging from AOP Transaction Rollback

Hi. I have a j2ee web application running on Spring framework. It uses Log4j for logging and Spring's AOP and Spring's transaction manager (e.g DataSourceTransactionManager) for roll-bakc during exceptions. I believe the best way to put log errors or exceptions is on the catch. So assuming I put the logging here and rethrow or bubble-up...

Ant target for compile-time code instrumentation with Spring aspects

I have developed a web application using Netbeans 6.7 and Ant. The webapp works, but I would like to refactor the code to use @Configurable Spring annotation for cleaner dependency injection. I was able to get load-time weaving (LTW) of Spring aspects to work intermittently (see http://forum.springsource.org/showthread.php?t=86904). At...

Adding functionality to any TextReader

I have a Location class which represents a location somewhere in a stream. (The class isn't coupled to any specific stream.) The location information will be used to match tokens to location in the input in my parser, to allow for nicer error reporting to the user. I want to add location tracking to a TextReader instance. This way, w...