0

Can someone use a bean reference in a SpEL expression in an annotation? (in XML it is definitely possible using the bean id in #{}). In general, are there any restrictions/limitations for SpEL expressions used in XML files vs. those used in annotations such as @Value?

user998692
  • 5,172
  • 7
  • 40
  • 63

1 Answers1

3

This is an odd question - why don't you just try it and ask a specific question if something doesn't work as you expect?

However, yes, you can use SpEL in @Value...

@Value("#{@foo.substring(1) + @bar.substring(2)}")
String foo;
Gary Russell
  • 166,535
  • 14
  • 146
  • 179