Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.32k stars 1.97k forks source link

[FEATURE REQ] Missing "additional-spring-configuration-metadata.json" in artifact spring-cloud-azure-starter-appconfiguration-config #41502

Open 1goldenboy opened 1 month ago

1goldenboy commented 1 month ago

Is your feature request related to a problem? Please describe. Intellij issues warnings when using the configuration properties available in spring-cloud-azure-starter-appconfiguration-config. It seems that Intellij is unable to pick up AppConfigurationProperties.class in spring-cloud-azure-starter-appconfiguration-config. Instead it picks up AppConfigurationProperties.class in spring-cloud-azure-autoconfigure and marks the other properties as missing. For example considering this configuration in bootstrap.yaml

spring:
  cloud:
    azure:
      appconfiguration:
        enabled: true
        stores:
          - endpoint: 'https://my-store-in-azure.azconfig.io'
            feature-flags:
              enabled: true
            selects:
              - keyFilter: '/my-api/'

Then "enabled" would not be marked since it is present in both the classes, but "stores" would be marked as missing since its only present in spring-cloud-azure-starter-appconfiguration-config

Describe the solution you'd like I believe adding the following dependency to the classpath when compiled would solve the issue

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <optional>true</optional>
</dependency>

However, investigating it seems that all properties is defined in spring-cloud-azure-autoconfigure, so perhaps it should be updated there instead?

Describe alternatives you've considered Ignore the warnings

Additional context None

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

github-actions[bot] commented 1 month ago

@moarychan @netyyyy @rujche @saragluna

github-actions[bot] commented 1 month ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Netyyyy commented 1 month ago

@mrm9084 please help take a look

1goldenboy commented 1 month ago

Some additional context and pictures:

Here is the warning Intellj issues:

image

Property 'enabled' is recognized by Intelij, but points to an unexpected class -> com.azure.spring.cloud.autoconfigure.implementation.properties.core.AbstractAzureServiceConfigurationProperties

image

Properties 'endpoint', 'keyFilter' and 'labelFilter' is not recognized

The expected class is in the azure appconfiguration artifact -> com.azure.spring.cloud.appconfiguration.config.implementation.properties.AppConfigurationProperties

image

As mentioned I do believe this is because the azure appconfiguration artifact is missing an additional-spring-configuration-metadata.json file which 'spring-boot-configuration-processor' would generate on compile

image

mrm9084 commented 1 month ago

@1goldenboy, this should be fixed and will be part of the next release which should be in the next week or so. I'll post here when it's out.

1goldenboy commented 1 month ago

Thank you so much for the quick fix! Looking forward to the next release!

1goldenboy commented 2 weeks ago

Just checked it out. It looks great!

I found one minor thing. LabelFilter is still getting a warning since it only has a setter and not an equivalent getter (ref: https://github.com/spring-projects/sts4/issues/1180). I think changing this would require to add equivalent getter public String getLabelFilter() both in FeatureFlagKeyValueSelector.java and AppConfigurationKeyValueSelector.java.

All remaining properties here are working fine! https://github.com/Azure/azure-sdk-for-java/tree/spring-cloud-azure-appconfiguration-config_5.16.0/sdk/spring/spring-cloud-azure-starter-appconfiguration-config