I want to conditionally create an Aspect
depending on a value read from the properties file. (It is related to profiling, that's why the intended selective use).
I have tried to create a class that implements Condition and therefore the matches()
method that would allow me to perform the validation necessary and set the output to the corresponding Boolean
, enabling or disabling it.
@Aspect
@Conditional(MyCondition.class)
public class MyAspect {
...
pointCuts, methods and etc...
...
}
Thing is: The Aspect
is instantiated by Spring anyway apparently it does not respect the @Conditional
annotation output.
Are there any caveats that I am missing here?
Versions:
Spring version: 4.1.4.RELEASE
AspectJ version: 1.7.3
(The project dependency tree is a bit 'complicated' so updating libs has to be taken with a grain of salt :) )