One of common issues I've seen engineers face when upgrading to Spring Boot 3 is having a dependency on a Spring Boot starter that doesn't support Spring Boot 3. To be more exact, that don't support new autoconfiguration discovery mechanism introduced in 2.7. Usually issue becomes apparent when there are beans that should be provided but aren't and the startup fails. Sometimes unfortunately startup might not fail as a spring boot starter doesn't provide beans but only modifies behavior of existing beans. This can cause bugs in production and a lot of frustration for both developers and customers.

I'd like to request support for auto detection and failure of spring boot starters that do include spring.factories with org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ but do not include org.springframework.boot.autoconfigure.AutoConfiguration.imports. Note that both parts of the condition are equally important as some spring boot starters might decide to support both the new and the old mechanism.

I believe this change would make migration a lot less painful.

Comment From: wilkinsona

Thanks for the suggestion. We considered this before and decided it against it for a couple of reasons:

  1. We hoped that 2.7 supporting both mechanisms would provide a way for users to update auto-configurations to use the new mechanism before moving to 3.0 which requires it.
  2. We had some concerns about the performance implications of looking for entries in both spring.factories and AutoConfiguration.imports

Evidently, for you at least, 1 hasn't worked out as we hoped. 2 remains something of a concern although I'm not sure if we ever measured the cost. It might be possible for us to perform the check at build time which would avoid any runtime cost entirely.

I'll flag this for discussion at a team meeting so we can consider things again.

Comment From: lpandzic

Problem with 1 is that it puts me into a weird spot as a spring boot starter maintainer - I honestly didn't even know about this problem until SB 3 was out. 1 assumes that spring boot starters will support both 2.7 and 2.6 mechanisms at once? Is this even possible and/or documented anywhere?

Comment From: wilkinsona

The new .imports files are documented in the release notes. As they note, spring.factories is still supported in 2.7 for backwards-compatibility. You can declare the same auto-configuration in both locations and we'll remove any duplicates.

Comment From: philwebb

We've discussed this today as a team and we think that the costs of the checks outweigh the benefits at this time. We're going to close this one but we'll keep an eye on it to see if any other library authors have the same problem.

Comment From: lpandzic

Fair enough.