I need to make a check in my pointcut expression like.
I have this bean:
<bean id="logConfig"
class="com.celfocus.ufe.base.logging.domains.LoggingConfiguration">
<property name="logDetails" value="STANDARD" />
<property name="logLvl" value="COMPLETE" />
</bean>
In my aop pointcut expression i need to make a check to verify the value of bean property “logLvl”.
<aop:config>
<aop:aspect ref="ufeLogger">
<aop:pointcut id="complete" expression="execution(* *.*(..)) and bean(logConfig)==COMPLETE" />
<aop:before pointcut-ref="complete" method="logBefore" />
</aop:aspect>
</aop:config>
My expression isn’t working… what I can change to make this check?
What makes you think that
and bean(logConfig)==COMPLETEis a valid pointcut? Spring AOP uses AspectJ pointcut syntax, no Spring additions. Also you are not even referencinglogLvlproperty, so has is this suppose to work?Unfortunately to achieve this you must implement check manually. This isn’t so intrusive though: simply inject
logConfigintoufeLoggeraspect and add a simple condition inlogBefore()method.