Probably a really basic question but I'm looking for the approach you take to making it easy (at build time or run time based on a property) to not having an aspect applied?
Currently I have a single timeMethod aspect that I'd like to only be applied based on an property found in my application.properties file.
I'm not exactly sure of how to do the above, so instead for now I have my web.xml load a profile and then I'm toggling on the profile name:
Code:
<env-entry>
<env-entry-name>spring.profiles.active</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>${env}</env-entry-value>
</env-entry>
Then in my config...
Code:
<beans profile="local">
<bean id="timeMethodAspect" class="com.foo.service.TimeMethodAspect"/>
</beans>
"env" is a property that gets set when maven does its build of the war and it pulls that value from the filter.
The above works but I don't like it. I want to toggle specifically on something like "applyAspects" read from a property...
This way I could easily turn the application of the aspects on or off across any environment. (Note, it's fine if it's a build time thing.. doesn't have to be at run time.)
What's the best approach to achieve what I want to do ? Thanks.