fix: stop exporting Spring Framework from the Spring module - #408
Conversation
spring-context in observability-kit-spring, and spring-boot-autoconfigure and spring-boot-starter-micrometer-metrics in observability-kit-starter, are now provided scope, so the kit no longer exports Spring artifacts transitively. The application brings Spring and Spring Boot and defines their versions. The auto-configuration now references Boot's Micrometer metrics auto-configurations by name, as they are no longer guaranteed to be on the classpath. Applications using the starter must declare spring-boot-starter-micrometer-metrics, or spring-boot-starter-actuator which includes it.
A Spring Boot starter is expected to bring the starters it builds on, so observability-kit-starter keeps spring-boot-starter-micrometer-metrics and spring-boot-autoconfigure at compile scope and stays a single-dependency setup. Only observability-kit-spring keeps spring-context provided.
heruan
left a comment
There was a problem hiding this comment.
Starter changes look good now, agree with Artur. A few things on the Spring module:
spring-contextstill comes in transitively.vaadin-springis a compile dependency here and bringsspring-webmvc, which depends onspring-context,spring-web,spring-beansandspring-core(seemvn dependency:tree -pl :observability-kit-spring). So the kit still picks the Spring version. To fix it, markvaadin-springas optional too. Apps using this module are Vaadin Spring apps, so they already have it.- Please use
<optional>true</optional>instead ofprovidedforspring-context. That matchesspring-webin the same POM and is the usual Spring convention.providedis for things the container gives at runtime, like the servlet API. - With the current POM, "you must now add
spring-contextyourself" in the description is not true. Please update it after the fix. The README could also say the app needsvaadin-spring, and suggestspring-framework-bomto align Spring versions.
The application already has vaadin-spring and Spring Framework, so the module must not bring them, or it still decides the Spring version through vaadin-spring's own dependencies. The starter declares spring-web optional for the resync detection filter, and the plain Spring test application declares vaadin-spring itself.
The module's main code does not use vaadin-spring; only a test does.
|
@heruan Thanks, all three are addressed:
Unit tests pass (503) and the integration test applications build. |
|
The dependency on vaadin-spring should remain as that one is fixed in a flow pr, right? |
vaadin-spring is the Vaadin Spring integration the module builds on, and it stops exporting Spring itself in vaadin/flow#25927.
|
@Artur- Right. I restored One caveat: the kit currently builds against Flow 25.3. Until it moves to a Flow version that includes vaadin/flow#25927, |
Summary
The plain Spring module no longer pulls in Spring Framework (
spring-context) for the application. The application now declares Spring itself, so the application decides the Spring version, not the kit.What changed
Behavior change:
spring-contextis now an optional dependency inobservability-kit-spring, so it no longer comes in through the kit. This affects plain Spring apps (without Spring Boot) that useobservability-kit-springand gotspring-contextonly through the kit. These apps must now declarespring-contextthemselves (plusspring-webfor the HTTP observation hooks), best withorg.springframework:spring-framework-bomimported.vaadin-springstays a compile dependency ofobservability-kit-spring, so the module still brings it. Spring itself leavesvaadin-springin feat(spring)!: stop exporting Spring dependencies at compile scope flow#25927.spring-weba direct dependency of the starter, and fix: count resyncs from Flow events so the starter no longer needs spring-web #415 handles making it optional.vaadin-springdirectly.vaadin-springbut not Spring, and tells users to declare Spring Framework and import its BOM.🤖 Generated with Claude Code