Aspects of self-gravitating solitons and hairy black holes