0

I need to get the value of the property name logLvl of bean id logConfig and make a comparison on expression.

<bean id="logConfig"
    class="com.celfocus.ufe.base.logging.domains.LoggingConfiguration">
    <property name="logDetails" value="STANDARD" />
    <property name="logLvl" value="COMPLET" />
</bean>

<aop:config>
    <aop:aspect ref="ufeLogger">
        <aop:pointcut id="complete" expression="execution(* *.*(..)) and ($logConfig.logLvl=STANDARD)"  />

This piece of code gives an illegal identifier character =. What can I do to make this check?

Pang
  • 9,564
  • 146
  • 81
  • 122
Vítor Nóbrega
  • 1,219
  • 4
  • 26
  • 53

2 Answers2

0

Did you try ==? If you're doing a comparison, after all.

AHungerArtist
  • 9,332
  • 17
  • 73
  • 109
0

I've never seen anything making me think this would be possible--do you have documentation that demonstrates the use of expressions inside a pointcut like this? If anything, you could try using a SpEL escape #{}, but I'm skeptical. That'd be cool, though, if it worked.

My first approach would be to use the property value as a property on the aspect as well as the log config.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302