So then what exactly is @Value for. Well it is for Spring Expression Language. And in the Spring Expression language it can evaluate to anything, any type.
So yes, the evaluation of @Value("#dataSource") is the bean with the id called dataSource, and that it what it was evaluated to the ref of the bean or the DataSource itself and the instance variable is set to that value.
Les Hartzman wrote:Thanks for the response. The places where I've seen @Value used for strings has typically been when there is a properties file involved:
private String jdbcUrl;
Could @Inject or @Autowired have been used in place as well?
In this particular case, no. In the dataSource case way above, yeah. I probably would have chosed @Autowired or @Inject instead. You could partially argue that with @Value is like @Autowired with @Qualifier without it being 2 annotations, now it is just one.