Azure / Azure/azure-sdk-tools

[APIView] Consider Spring AutoConfiguration class as Non-public API

Open
#4,773 6 comments 0 reactions 1 assignee Claimed by @JonathanGiles View on GitHub
APIView Java
Dominant language
C#
Stars
135
Forks
260
Avg merge
1d 22h
Merged PRs (30d)
115

Description

Spring Cloud Azure has Spring Boot auto configuration support for various Azure SDK features.
We do that by providing `@Configuration` class, it acts like a `bean factory` to the Spring IoC container, which means the auto configuration classes are only accessed by Spring IoC framework, not users directly.

But we can't put these into `implementation` package since customer may need to access the *class name and class name only* to disable any auto configuration class.

According to [spring boot doc](https://docs.spring.io/spring-boot/docs/2.7.x/reference/htmlsingle/#using.auto-configuration.disabling-specific)

> Even though auto-configuration classes are public, the only aspect of the class that is considered public API is the name of the class which can be used for disabling the auto-configuration. The actual contents of those classes, such as nested configuration classes or bean methods are for internal use only and we do not recommend using those directly.

```java
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class MyApplication {

}
```

For example, this `https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/secrets/AzureKeyVaultSecretAutoConfiguration.java` auto configuration class, all the methods in it, are only accessed by Spring IoC, and not customer according to spring doc and conversion.

So, we'd like to have APIView tool aware of this spring feature and DO NOT consider any class with `org.springframework.context.annotation.Configuration` annotation as public API despite it's in implementation package or not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.