Fixed LiveBeansView to not produce invalid JSON if last bean is not eligible

Also introducing overridable isBeanEligible template method.

Issue: SPR-11366
(cherry picked from commit c1eac20)