Hi,
I think for a better solution a generic class should be created for this to solve it using Reflection too.

bean factory