generic beans hierarchy

PR for #865