This code is originally from Grails but modifications are made since then to make the syntax more consistent.
Our version has support for getting rid of surrounding "bb.beans { ... }" if the script
is parsed via the BeanBuilder.parse()
method.
Anonymous bean definition syntax is changed to bean(CLASS) {...}
from
{CLASS _ -> ...}
to increase consistency with named bean definition.