Extract common registration code and make use of the Spring Framework registration methods. See gh-17064