Skip to content

Transitive aopalliance dependency conflicts with spring-aopΒ #1536

Closed

Description

@raphw

AOP Alliance is an abandoned project and was compiled with Java 1.4. I think it is save to assume that it is abandoned and will no longer be developed. Nobody considers the library either, as far as I know.

To make things worse, Spring bundles and publishes their own version of aopalliance with an automatic module name and some modifications. This can break Java tooling and on the class path, it is random which one you observe.

Could you either:

  1. Remove this entirely.
  2. Replace the dependency with spring-aop.
  3. Remove this and offer two bridge versions where you subclass with spring-aop in one version and with aopalliance in the other one. You can also ship one version without the interfaces. This would need subclasses for the interface implementations.

Without this, micrometer-tracing can currently lead to annoying bugs and makes it difficult to use automatic modules on the module path as this breaks package exclusivity, what it should since this is a shadowing bug.

Thanks!

Activity

  1. shakuzen commented on Aug 28, 2026

    @shakuzen
    Member

    Thanks for bringing this to our attention. I think this is a byproduct of copied code from Spring Cloud Sleuth at the inception of Micrometer Tracing. I'm surprised no one has reported it before, as far as I remember. We'll have to think of the right way to migrate away from the dependency, considering backward compatibility concerns. Ideally, when we migrated the code to here, we would have made the aspect-related code follow the same pattern as in Micrometer, where we don't ship a dependency. Although, I do remember some users asked several years ago specifically for AOP Alliance support in Micrometer: micrometer-metrics/micrometer#1048.

  2. raphw commented on Aug 28, 2026

    @raphw
    Author

    I think the only way to do this, would be to remove the interfaces, and then to create another jar that depends on this library, and that creates subclasses with the interfaces implemented. This way, any user can choose to drag in the AOP Alliance, which I would recommend you to default to the maintained Spring AOP version.

    The method signatures can stay, so the classes will only loose their type, but not their shape. Of course, this is a breaking change anyways. With the minimal spread of AOP Alliance, you might however drop the dependency altogether.

    For a short term solution: You could switch out AOP Alliance with Spring AOP. Then Maven only resolves one version of the packages for users of Spring, which I would assume is the most common use case. This does not change binaries at all and users can exclude Spring AOP and include AOP Alliance if they wanted to. This is also how I solve it right now, just the other way around.

  3. changed the title [-]Remove aopalliance dependency[/-] [+]Transitive aopalliance dependency conflicts with spring-aop[/+] on Sep 2, 2026
  4. shakuzen commented on Sep 2, 2026

    @shakuzen
    Member

    I've opened #1543 to make the aopalliance dependency optional (the same as the aspectj dependency). Everything should continue to work for Spring users because of the included aopalliance classes in spring-aop. It's only SpanAspect users who aren't using spring-aop that might be affected. From my limited research, I'm hopeful that's exceedingly few users. They can add the aopalliance dependency back to their application as a quick remedy. It's not ideal for us to switch a dependency to optional in a minor release, but the current situation is also not ideal and this seems minimally impactful in practice.

  5. added this to the 1.8.0-M2 milestone on Sep 2, 2026
  6. added a commit that references this issue on Sep 3, 2026
    997f404
  7. shakuzen commented on Sep 3, 2026

    @shakuzen
    Member

    I opened #1546 to add a note to the reference documentation about the dependencies being optional but needed for using the SpanAspect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions