spring-aop

AOP for third-party classes

I have used AOP within spring with no real problems, mainly for transaction management, for which it works a charm. My question is this... the only examples I've seen for AOP so far is to pointcut a class that you have created yourself. Is it possible to pointcut a class within a third party library, for example a database connection c...

Implementing Audit Trail- Spring AOP vs.Hibernate Interceptor vs DB Trigger

I found couple of discussion threads on this- but nothing which brought a comparison of all three mechanism under one thread. So here is my question... I need to audit DB changes- insert\updates\deletes to business objects. I can think of three ways to do this 1) DB Triggers 2) Hibernate interceptors 3) Spring AOP (This question i...

Spring AOP error

What would cause this problem at run-time?: The matching wildcard is strict, but no declaration can be found for element 'aop:config' Here is the relevant Spring XML: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframe...

Spring-AOP & MultiThreading

i am having trouble multithreading my app. It seems AOP is unable to span over multiple threads i.e. i am unable to execute all the threads within a single transaction. Every thread updates the database on processing. I am using fixedThreadPool and ExecutorCompletionService. Is this a problem with spring? ...

Can I inject code in spring using AOP annotations?

Is it possible to do something like the following: public void doStuff(@RequirePrivilege("foo") User user) { // ... } and have it effectively run as if it were the following? public void doStuff(User user) { if(!user.hasPrivilege("foo")) throw new UserHasInsufficientPrivileges(); // this is a RuntimeException // ... } I ...

Do method profiling ( Basic execution time ) With Spring AOP

Hi, I'm looking for a feature or software, who will allow me to easily profile my method execution time. And choose what to profile by package filter. I know, it's profiler 101. I use the TPTP profiler. But i'm not happy with it. To be franck, i just dont understand how it's work, and when i profiling my application ( launch the serve...

Hibernate lazy initialization help

Hi, I have an issue trying to delete using hibernate. When I try to delete I get an exception saying that children exist and there is a FK violation. I want to delete the children also but the delete doesn't seem to be cascading. After about a week of trying to fix this issue I read that I should be using HibernateInterceptor to keep...

Interesting AOP question on a cross cutting concern?

Consider a set of DOAs with methods similar to this public void addObject(Long sessionId, Long clientId, Dom obj){...} Now every domain pojo (Dom) has a sessionId property and for every insert, update or delete on a domain object a sessionId must be passed with setSessionId(Long sessionId)so we can know who does what. But it seems tha...

Spring and AOP Configuration on Common Java Type Extensions

I have the following XML cross cutting definition in my context: <bean name="/Details.htm" class="com.DetailServlet"> <property name="myPerfLogger" ref="perfLogger"></property> </bean> <bean id="perfLogger" class="com.PerformanceLogger"/> <bean id="methodLogger" class="com.MethodLogger"/> <aop:config> <aop:pointcut i...

How to implement Abstract Factory pattern in Spring-AOP?

Is implementing the Abstract Factory pattern for a spring-based project with AOP should be any different than in a normal project? ...

java.lang.NoClassDefFoundError: ProceedingJoinPoint

We have a number of web service client applications which interface between our main customer facing application and backend web services. These web service application generate their own JAXWS stub code to directly interface with the web services and implementation code to provide a clean interface between the JAXWS code and any applica...

GWT: get locale information from server side ?

I use GWT along with Spring/Hibernate/AOP. I use an Aspect to send notification emails. In one of my Aspect, I want to get the current locale from GWT,so that I can send the localized email to the user. Is there a way to access GWT Locale data from the client side? Thanks ...

@AspectJ pointcut for all methods of a class with specific annotation

I want to monitor all public methods of all Classes with specified annotation (say @Monitor) (note: Annotation is at class level). What could be a possible pointcut for this? Note: I am using @AspectJ style Spring AOP. ...

Is using Spring AOP for logging a good idea?

I'm reading up on Spring at the moment and one of the examples used for a use of AOP is logging the start and end of method calls. I've also read that using AOP can impact performance. Is using Spring AOP a good idea for this type of logging? My understanding is that Spring uses Dynamic AOP would it be be better to use Static AOP (Like...

Spring MVC Application - How do I set a session scoped bean value

In my application I need to gather information on one screen and then display it on the next. I have selected to store this information in a bean with a scope set as session ( it will be used in several other screens after the initial data gathering screen) Manger configured as follows: <bean name="/springapp.htm" class="foo.bar.cont...

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(....

Access bean name in custom method interceptor

I want to write bean name and method executed in database so decide to create an custom interceptor. However, I am not able to access the bean name. I found ExposeBeanNameAdvisors may be one of the solution, but not able to find a point to set the name. Anyone have the ideas about this? Many thanks!! ...

Obtain real Class object for Spring bean

Hi, I am using Spring to inject beans. And I am using some annotations to annotate bean methods (Security, TransactionManagement, ExceptionHanling, Logging). The problem is: I want to create JUnit test to check if I forgot annotate some methods. But Spring returns $ProxyXXX class without any annotations on methods.. Method[] methods =...

Spring AOP AfterThrowing vs. Around Advice

Hey there, when trying to implement an Aspect, that is responsible for catching and logging a certain type of error, I initially thought this would be possible using the AfterThrowing advice. However it seems that his advice doesn't catch the exception, but just provides an additional entry point to do something with the exception. T...

Spring AOP: how to get the annotations of the adviced method

I'd like to implement declarative security with Spring/AOP and annotations. As you see in the next code sample I have the Restricted Annotations with the paramter "allowedRoles" for defining who is allowed to execute an adviced method. @Restricted(allowedRoles="jira-administrators") public void setPassword(...) throws UserMg...