Azure / Azure/azure-sdk-for-java

[FEATURE REQ] Generate failure message when Spring Boot and Spring Cloud Azure version mismatch

Open
#32,593 1 comment 0 reactions 1 assignee Claimed by @rujche View on GitHub
azure-spring azure-spring-boot Client feature-request
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

### Context
Since Spring Boot(SB) has released multiple major versions(2.x and 3.x), and Spring Cloud Azure(SCA) also has released multiple major versions(4.x and 6.x) to match the SB version, At the same time, there are multiple versions(2021.x & 2022.x) corresponding to Spring Cloud(SC). If the customer does not read this [SCA version mapping](https://github.com/Azure/azure-sdk-for-java/wiki/Spring-Versions-Mapping#spring-cloud-azure-support-status) carefully, it is likely to use the wrong version.

### Problem statement

If customers use the below combination, the application will fail to start and the error message is not clear or actionable.
- SB 2.x + SCA 6.x
- SB 3.x + SCA 4.x

SCA should make the application fast fail with a clear message.

### User scenarios

Note:
- 'SCA with SC component' means the following artifacts
- spring-cloud-azure-starter-stream-eventhubs
- spring-cloud-azure-starter-stream-servicebus
- spring-cloud-azure-stream-binder-eventhubs
- spring-cloud-azure-stream-binder-servicebus

- 'SCA not SC component' means all SCA artifacts except those listed above.

#### Scenario 1: SB 2.x + SCA 6.x(not SC component)

##### Current behavior and message

The application fails to start, the error message as below:

```console
Description:

Your project setup is incompatible with our requirements due to following reasons:
- Spring Boot [2.7.4] is not compatible with this Spring Cloud Azure version.

Action:

Consider applying the following actions:
- Change Spring Boot version to one of the following versions [3.0.0].
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn].
If you want to learn more about the Spring Cloud Azure compatibility, you can visit this page [https://aka.ms/spring/versions] and check the [Which Version of Spring Cloud Azure Should I Use] section.
If you want to disable this check, just set the property [spring.cloud.azure.compatibility-verifier.enabled=false].
```

##### Expected behavior and message

The application fails to start, and a more accurate message should be output as below:

```console
Description:

Your project setup is incompatible with our requirements due to following reasons:
- Spring Boot [2.7.4] is not compatible with this Spring Cloud Azure version.

Action:

Consider applying the following actions:
- Change Spring Boot version to one of the following versions [3.0.0-M4].
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn].
If you want to learn more about the Spring Cloud Azure compatibility, you can visit this page [https://aka.ms/spring/versions] and check the [Which Version of Spring Cloud Azure Should I Use] section.
If you want to disable this check, just set the property [spring.cloud.azure.compatibility-verifier.enabled=false].
```

#### Scenario 2: SB 2.x + SCA 6.x(with SC component)

##### Current behavior and message

The application fails to start, this is expected, but the error message is not clear and the customer is having a difficult time finding the root cause of the failure. See full stack trace from this issue description.

##### Expected behavior and message

The application fails to start, and instead of outputting an error stack trace, it should output a clear message, as expected by *Scenario 1*.

#### Scenario 3: SB 3.x + SCA 4.x(not SC component)

##### Current behavior and message

The application fails to start, the error message as below:

```console
Description:

Your project setup is incompatible with our requirements due to following reasons:
- Spring Boot [3.0.0-M4] is not compatible with this Spring Cloud Azure version.

Action:

Consider applying the following actions:
- Change Spring Boot version to one of the following versions [2.5.x, 2.6.x, 2.7.x].
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn].
If you want to learn more about the Spring Cloud Azure compatibility, you can visit this page [https://aka.ms/spring/versions] and check the [Which Version of Spring Cloud Azure Should I Use] section.
If you want to disable this check, just set the property [spring.cloud.azure.compatibility-verifier.enabled=false].
```

##### Expected behavior and message

Behavior and error messages as expected.

#### Scenario 4: SB 3.x + SCA 4.x(with SC component)

##### Current behavior and message

The application fails to start, the error message as below:

```console
Description:

Your project setup is incompatible with our requirements due to following reasons:
- Spring Boot [3.0.0-M4] is not compatible with this Spring Cloud Azure version.

Action:

Consider applying the following actions:
- Change Spring Boot version to one of the following versions [2.5.x, 2.6.x, 2.7.x].
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn].
If you want to learn more about the Spring Cloud Azure compatibility, you can visit this page [https://aka.ms/spring/versions] and check the [Which Version of Spring Cloud Azure Should I Use] section.
If you want to disable this check, just set the property [spring.cloud.azure.compatibility-verifier.enabled=false].
```

##### Expected behavior and message

Behavior and error messages as expected.

### Follow up considerations

#### What's the alignment to choose

##### Alignment 1

- Spring Cloud verifies Spring Boot version

- Spring Cloud Azure verifies Spring Boot version

##### Alignment 2

- Spring Cloud Azure verifies Spring Boot version
- Spring Cloud Azure verifies Spring Cloud version

#### What phases of verification occur

- On JVM startup

- On Application Context bean initialization (SCA selected)

- On Application Context other stages

#### SCA verifies which version

- Only Spring Boot version

- Spring Boot and Spring Cloud

#### Who to enable SB and SC verification when using SC component-based SCA

- SCA
- Spring Cloud Stream

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.