There is something wrong or incomplete in the SpEL documentation.

  • SimpleEvaluationContext.forReadOnlyDataAccess() doesn't compile. I think that should be SimpleEvaluationContext.forReadOnlyDataBinding().build().
  • The "following example" has no mention of #root.

The following examples show how to use the #this and #root variables:

Comment From: sbrannen

Thanks for bringing that to our attention, @mhalbritter. 👍

I've fixed those errors (as well as some others that I noticed in the process) and added a new example using #root.

See the 6.1.2 snapshot reference docs.

Comment From: mhalbritter

Thanks Sam!