refactor Better validation for the configuration beans

The same code was used in several places, the idea is to mutualize it for a better code size and maintenance