I think the naming needs to be revisited - first I believe you need to call the variant of `generateBeanName` that takes `true` in `innerBean`.

However, I don't see any reason to use a generated name at all - can't we simply say

if the chain element has an id; name the bean `chainHandlerId + "$child." + id`
else `chainHandlerId + "$child#" + order`

and only register the ones with a specific id.

Of course, we need to detect and reject duplicate ids in the chain.