Reputation: 6989
I am currently trying to inject Spring bean in AspectJ like the code shown below, anyhow I the server (WAS Liberty Profile) keep complaining the method aspectOf is missing. May I know how could I solve this problem?
application-context.xml
<aop:aspectj-autoproxy/>
<import resource="/context-file-A.xml"/>
context-file-A.xml
<bean id="loggingAspect" class="com.huahsin.LoggingAspect" factory-method="aspectOf">
JAVA code
@Aspect
public class LoggingAspect {
...
}
Upvotes: 8
Views: 4588
Reputation: 3149
AspectJ needs to weave both - your aspect class and the target class.
Upvotes: 5
Reputation: 159784
This is a common error when wiring up aspect classes. It means that your aspect class, in this case LoggingAspect
has not been converted into an aspect which can be applied.
2 methods to weave your class into an aspect are using the AJDT Eclipse plugin or the Maven AspectJ compiler plugin.
There are 3 ways to weave aspects:
Before an aspect class can be applied to a class it first need to be 'weaved' into an aspect.
An weaved aspect class will have these static methods added.
Upvotes: 7
Reputation: 10745
The problem is that your AspectJ weaving process isn't working. So you're calling the aspectOf
method on an ordinary Java class and not an AspectJ class.
A simple way to test this:
Upvotes: 2