refactor Better validation for the configuration beans

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