Added support @Scope for @ConfigurationProperties beans.

To use AnnotationScopeMetadataResolver I had to use AnnotatedGenericBeanDefinition.

Also, I added several tests to verify definition configurations.

gh-41668

Comment From: nosan

If RootBeanDefinition cannot be changed for some reason, ScopeMetadata can be obtained by

ScopeMetadata metadata = scopeMetadataResolver.resolveScopeMetadata(new AnnotatedGenericBeanDefinition(type));

Or

private ScopeMetadata getScopeMetadata(Class<?> type) {
    ScopeMetadata metadata = new ScopeMetadata();
    MergedAnnotation<Scope> annotation = MergedAnnotations.from(type, SearchStrategy.TYPE_HIERARCHY).get(Scope.class);
    if (annotation.isPresent()) {
        metadata.setScopeName(annotation.getString("value"));
        ScopedProxyMode proxyMode = annotation.getEnum("proxyMode", ScopedProxyMode.class);
        if (proxyMode == ScopedProxyMode.DEFAULT) {
            proxyMode = ScopedProxyMode.NO;
        }
        metadata.setScopedProxyMode(proxyMode);
    }
    return metadata;
}

Comment From: snicoll

Good stuff @nosan, thanks again! Yeah, I think it makes sense to move to AnnotatedGenericBeanDefinition given the requirement here. I did that in https://github.com/spring-projects/spring-boot/commit/23d76a05e73dba1a91a70ab47b4e0be5ddf44040

Comment From: nosan

Thanks @snicoll,

I'm not sure if you've had a chance to see my message on Gitter. If you haven't yet, could you please take a look? I'd appreciate hearing your thoughts on the proposed changes. Apologies for tagging you here, and thanks in advance!