1

I cannot create a bean of AADAuthenticationProperties, and the reason sais that the property activeDirectoryGroups cannot be empty.

The error is the following:

Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'azure.activedirectory' to com.microsoft.azure.spring.autoconfigure.aad.AADAuthenticationProperties failed:

Property: azure.activedirectory.activeDirectoryGroups
Value: null
Reason: no puede estar vacío

This is the two ways a tried:

    //1st option
    @Bean
    @ConditionalOnMissingBean
    public AADAuthenticationProperties aadAuthenticationPropertiesFactory() {
        return new AADAuthenticationProperties();
    }

    //2nd option
    @Bean
    @ConditionalOnMissingBean
    public AADAuthenticationProperties aadAuthenticationPropertiesFactory() {
        AADAuthenticationProperties aadAuthenticationProperties = new AADAuthenticationProperties();
        aadAuthenticationProperties.setactiveDirectoryGroups(new ArrayList<>());
        return aadAuthenticationProperties;
}

But the error remains the same, so any idea about what is the activeDirectoryGroups property and how can I create a bean of AADAuthenticationProperties? I am using Java 8.

Thank you so much!

  • Delete the beans and just specify the properties in your `application.properties`. Those beans will be generated by the azure auto configuration. Your definition interferes with that. – M. Deinum Aug 06 '19 at 08:52

1 Answers1

2

Just like @M.Deinum said in the comment, you just need to specify the properties in your application.properties. The bean will be generated by the azure auto configuration. Refer to this document for more details.

azure.activedirectory.active-directory-groups=group1, group2
Tony Ju
  • 14,891
  • 3
  • 17
  • 31