I want to inject a guava Predicate into my bean, which should be an equalto inside a not.
I tried this:
<bean id="bla" class="something">
<property name="indexPredicate" value="#{T(com.google.common.base.Predicates).not(T(com.google.common.base.Predicates).equalTo(145028) )}" />
</bean>
But it throws exception:
Caused by: org.springframework.expression.spel.SpelParseException:
EL1049E:(pos 36): Unexpected data after ‘.’: ‘not(!)’
Spring 3.0.5, Guava 11.0.2
How can I make it work?
Apparently SpEL thinks you mean the Operator
not. However, I don’t see any way to escape or disambiguate that in the documentation. Perhaps you need to file a feature request for that.Alternatively, here is the pre-3.0 factory-method approach. It’s horrible, I know, but it might be an acceptable workaround in your case: