I’m moving a legacy application (I seem to be doing that a lot recently) to Spring and injecting properties with @Value into Spring managed beans all over the place. And it doesn’t work:
public class SomeService{ @Value("#{the.org.namespace.someProperty}") private String someProperty; }
Dots have apparently a special meaning, so this fails with a message that ‘the’ can’t be found:
EL1008E:(pos 0): Field or property 'the' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'
They know about it [1], they said the fixed it [2] but up to now (3.2.4) they didn’t.
The solution is surprisingly simple: use $ instead of #
public class SomeService{ @Value("${the.org.namespace.someProperty}") private String someProperty;
}
Resources
Oh my! So many hours and tries. Thanks!
LikeLike