Skip to content

Feat/2053 spring boot 4 - #2098

Merged
lbroudoux merged 18 commits into
microcks:masterfrom
Heyy-Himanshuu:feat/2053-spring-boot-4
May 12, 2026
Merged

lbroudoux merged 18 commits into
microcks:masterfrom
Heyy-Himanshuu:feat/2053-spring-boot-4

Conversation

@Heyy-Himanshuu

@Heyy-Himanshuu Heyy-Himanshuu commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

fixes #2053

Done

pom.xml

  • Bump spring-boot.version 3.5.14 → 4.0.6
  • Pin Jackson 2.x BOM ahead of the SB BOM (Quarkus 3 minion + commons modules still on 2.x, per your guidance)
  • Drop spring-boot-starter-aop (project had zero AspectJ usage in main; SB4 renamed it to -aspectj anyway — added back as spring-boot-starter-aspectj later for WithSpanAspect)
  • Add spring-boot-starter-restclient (RestTemplateBuilder moved out of spring-boot in SB4)
  • Add spring-boot-starter-kafka (KafkaProperties moved out of spring-boot-autoconfigure in SB4)
  • Drop <junit.version> override — SB4 manages Jupiter 6.0.3 + Platform 6.x consistently; the override was masking junit-platform-launcher riding along unpinned

SB4 modularization — package renames (main)

  • org.springframework.boot.autoconfigure.kafka.KafkaProperties → org.springframework.boot.kafka.autoconfigure.KafkaProperties
  • org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration → org.springframework.boot.security.oauth2.client.autoconfigure.OAuth2ClientAutoConfiguration (also dropped .servlet — servlet+reactive merged)
  • org.springframework.boot.web.client.RestTemplateBuilder → org.springframework.boot.restclient.RestTemplateBuilder

Spring Framework 7 API churn (main)

  • HttpHeaders no longer extends MultiValueMap: containsKey() → containsHeader(), entrySet() → headerSet(), put() → addAll(); 4 call sites that pass HttpHeaders where Map<String,List<String>> is expected now use .asMultiValueMap()
  • UriComponentsBuilder.fromHttpUrl() → fromUriString()
  • HttpComponentsClientHttpRequestFactory.setConnectTimeout(int) removed → RequestConfig.custom().setConnectTimeout(...)
  • RestTemplateBuilder.setReadTimeout(Duration) → readTimeout(Duration)
  • KafkaProperties.Producer.buildProperties(SslBundles) → buildProperties()
  • ResponseEntity null-body constructor disambiguated in SecretController

Spring Security 7 — Resource Owner Password Grant removed

Per your guidance went with option (b) — vendored DefaultPasswordTokenResponseClient + OAuth2PasswordGrantRequest into io.github.microcks.security.oauth2.password.* so the feature keeps working under SB4 and can be properly deprecated in 1.16.0. Sibling clients (Default*TokenResponseClient for Client Credentials and Refresh Token) got renamed to RestClient*TokenResponseClient.

Test infrastructure (drop-in path, evaluation here)

  • TestRestTemplate → org.springframework.boot.resttestclient.TestRestTemplate + @AutoConfigureTestRestTemplate on AbstractBaseIT / MicrocksApplicationFuzz
  • @SpyBean → @MockitoSpyBean from org.springframework.test.context.bean.override.mockito
  • @AutoConfigureMockMvc / MockMvcPrint → org.springframework.boot.webmvc.test.autoconfigure.*
  • ClientHttpRequestFactorySettings.Redirects (removed) → top-level HttpRedirects from org.springframework.boot.http.client
  • spring.data.mongodb.uri → spring.mongodb.uri (Mongo connection props moved out of spring.data.* in SB4 — testcontainer URI was silently ignored before this)

OpenTelemetry — swapped community starter for Spring's official

  • Dropped io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter + opentelemetry-instrumentation-bom; pulled in spring-boot-starter-opentelemetry
  • Spring's official starter does not consume the OTel SDK-autoconfigure SPI, so the legacy @Bean AutoConfigurationCustomizerProvider was rewired:
    • CustomExplainTraceProcessor is @Component → picked up by OpenTelemetryTracingAutoConfiguration.spanProcessors(ObjectProvider<SpanProcessor>)
    • XTraceIdTextMapPropagator exposed as @Bean TextMapPropagator → composed by otelContextPropagators(ObjectProvider<TextMapPropagator>)
  • Added a local 30-line WithSpanAspect to replace the one the community starter brought in — the official starter intentionally doesn't ship one (rationale in the resolved review thread)
  • management.tracing.sampling.probability=1.0 to preserve the 100% sampling the project previously got via the SDK-autoconfigure-only otel.traces.sampler.arg=1.0

Build status

✅ build-install — green
✅ integration-tests — green (61 ITs)
✅ fuzzing-tests — green
✅ javadoc-check — green
⬜ package-native — only runs post-merge on upstream (event_name != 'pull_request'). Audited locally: webapp process-aot runs cleanly under SB 4.0.6 + JDK 25; native profile config (BP_JVM_VERSION=25, builder pinned, reachability metadata wiring) unchanged. Async minion is Quarkus, decoupled.

Follow-ups (separate issues)

  • Migrate non-SSE ITs to RestTestClient; rewrite the 4 SSE tests with RestClient.exchange(ExchangeFunction) so they keep raw stream access. Then drop the spring-boot-resttestclient dep.
  • Deprecate the vendored Password Grant in 1.16.0.

…mport fixes

- Bump spring-boot.version to 4.0.6
- Pin Jackson 2.x BOM to maintain compatibility with Quarkus 3 minion
- Drop spring-boot-starter-aop (unused, replaced by spring-context)
- Migrate package renames in SB 4:
  - org.springframework.boot.autoconfigure.kafka -> org.springframework.boot.kafka.autoconfigure
  - org.springframework.boot.autoconfigure.security.oauth2.client.servlet -> org.springframework.boot.security.oauth2.client.autoconfigure.servlet
  - org.springframework.boot.web.client -> org.springframework.boot.restclient

Pending: OAuth2AuthorizedClientProvider — Password Grant removed in Spring Security 7,
needs design decision (drop / reimplement manually / deprecate).

Signed-off-by: Git-HimanshuRathi <[email protected]>
… client autoconfig package

- Add spring-boot-starter-restclient (RestTemplateBuilder moved out of spring-boot in SB 4)
- Add spring-boot-starter-kafka (KafkaProperties moved out of spring-boot-autoconfigure)
- Drop the .servlet sub-package from OAuth2ClientAutoConfiguration import (SB 4 merged
  the servlet and reactive variants into a single class)

Signed-off-by: Git-HimanshuRathi <[email protected]>
@Heyy-Himanshuu
Heyy-Himanshuu marked this pull request as draft May 7, 2026 08:30
…rn in webapp

Spring Framework 7 and Spring Security 7 (pulled in by Spring Boot 4) renamed,
removed, or restructured several APIs. Mechanical fixes:

Spring Framework 7
- HttpHeaders no longer extends MultiValueMap. Migrate Map-style accessors:
  * containsKey() -> containsHeader()
  * entrySet()    -> headerSet()
  * put()         -> addAll()
- Bridge HttpHeaders -> Map<String,List<String>> call sites with .asMultiValueMap()
  (deprecated for removal — long-term these signatures should accept HttpHeaders directly)
- UriComponentsBuilder.fromHttpUrl() -> fromUriString()
- HttpComponentsClientHttpRequestFactory.setConnectTimeout(int) removed —
  configure on the underlying RequestConfig instead
- Disambiguate ResponseEntity null-body constructor in SecretController

Spring Boot 4
- RestTemplateBuilder.setReadTimeout(Duration) -> readTimeout(Duration)
- KafkaProperties.Producer.buildProperties(SslBundles) -> buildProperties()

Spring Security 7
- Resource Owner Password Grant removed (per OAuth 2.1). Microcks reimplements it
  manually via RestClient against the configured token endpoint to keep legacy
  IDP support during test execution.
- Default*TokenResponseClient classes renamed to RestClient*TokenResponseClient
- AuthorizationGrantType.PASSWORD and OAuth2ParameterNames.PASSWORD/USERNAME
  constants removed alongside the grant; the parameter names themselves remain
  part of the OAuth 2.0 spec.

Signed-off-by: Git-HimanshuRathi <[email protected]>
The root pom previously pinned <junit.version>5.12.2</junit.version> for
junit-jupiter, but junit-platform-* jars were inherited from Spring Boot's
BOM unpinned. Spring Boot 4 manages JUnit Jupiter 6.0.3 / Platform 6.x;
Jupiter 5.12 against Platform 6.x throws:

  OutputDirectoryCreator not available; probably due to unaligned versions
  of the junit-platform-engine and junit-platform-launcher jars

Drop the version override so the SB4 BOM manages the whole JUnit family
consistently. Also drop the explicit <version>1.12.2</version> on
junit-platform-launcher in commons/util and commons/util-el for the same
reason.

Effect: commons/util, commons/model, commons/util-el tests now pass under
Spring Boot 4.0.6.

Signed-off-by: Git-HimanshuRathi <[email protected]>
…Security 6.5

Spring Security 7 removed the Resource Owner Password Credentials grant per
OAuth 2.1 (DefaultPasswordTokenResponseClient, OAuth2PasswordGrantRequest,
AuthorizationGrantType.PASSWORD, OAuth2ParameterNames.PASSWORD/USERNAME).

Per @lbroudoux's call on microcks#2053, vendor the two main classes into
io.github.microcks.security.oauth2 with @deprecated(since="1.15.0",
forRemoval=true) markers so the feature stays available for legacy IDPs in
test contexts while we plan removal in 1.16.0.

- OAuth2PasswordGrantRequest: vendored verbatim from SS 6.5; exposes a
  PASSWORD constant to replace the removed AuthorizationGrantType.PASSWORD.
- DefaultPasswordTokenResponseClient: equivalent of the SS 6.5 class but
  re-implemented with RestClient since the SS 7 removal also took out the
  AbstractOAuth2AuthorizationGrantRequestEntityConverter machinery the
  original relied on.
- OAuth2AuthorizedClientProvider: revert to the original code, only
  switching imports to the vendored package.
- OAuth2AuthorizeClientProviderTest: same — imports updated to the vendored
  package (deprecation warnings are intentional).

Signed-off-by: Git-HimanshuRathi <[email protected]>
… 4 modules

Spring Boot 4 split the test infrastructure across new modules and
moved several classes/annotations. Take the drop-in path:

- Add spring-boot-starter-webmvc-test (provides AutoConfigureMockMvc,
  MockMvcPrint moved out of spring-boot-test-autoconfigure)
- Add spring-boot-resttestclient (provides TestRestTemplate moved out
  of spring-boot-test). @SpringBootTest no longer auto-provides a
  TestRestTemplate bean, so AbstractBaseIT and MicrocksApplicationFuzz
  now also carry @AutoConfigureTestRestTemplate.

Source updates in webapp/src/test/java:
- TestRestTemplate: org.springframework.boot.test.web.client
  -> org.springframework.boot.resttestclient
- AutoConfigureMockMvc / MockMvcPrint:
  org.springframework.boot.test.autoconfigure.web.servlet
  -> org.springframework.boot.webmvc.test.autoconfigure
- @spybean: org.springframework.boot.test.mock.mockito.SpyBean
  -> @MockitoSpyBean from
  org.springframework.test.context.bean.override.mockito (the SB-test
  annotations were removed in favour of the Spring TestContext ones)
- ClientHttpRequestFactorySettings.Redirects (removed) -> top-level
  HttpRedirects in org.springframework.boot.http.client (used by
  TestRestTemplate.withRedirects)

The full RestTestClient migration is intentionally not in scope for
this PR — see PR description for the trade-off.

Signed-off-by: Git-HimanshuRathi <[email protected]>
… official one

Spring Boot 4 ships its own spring-boot-starter-opentelemetry (released
Nov 2025). Per Spring's docs the community
io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter we
used on SB 3.5 should not be mixed with the official one — drop it
entirely along with the opentelemetry-instrumentation-bom import and
the five exclusions that came with the community starter.

Two transitive deps the community starter used to provide are now
explicit:
- opentelemetry-instrumentation-annotations (for @WithSpan, used in
  RestInvocationProcessor and GrpcInvocationProcessor). Pinned to
  2.21.0 — not managed by Spring's BOM.
- opentelemetry-sdk-extension-autoconfigure-spi (for the
  AutoConfigurationCustomizerProvider / ConfigProperties types used by
  OtelAutoConfigurationCustomizerProvider). Version managed by
  opentelemetry-bom imported via spring-boot-dependencies.

NOTE: the customizer compiles against the SPI but Spring Boot 4's
starter does not rely on the OTel SDK autoconfigure flow the same way
the community starter did. The @bean AutoConfigurationCustomizerProvider
hook may not fire at runtime — to validate via CI / integration tests,
and rewire as a Spring bean if needed.

Signed-off-by: Git-HimanshuRathi <[email protected]>
@Heyy-Himanshuu
Heyy-Himanshuu marked this pull request as ready for review May 7, 2026 14:48
Signed-off-by: Git-HimanshuRathi <[email protected]>
Spring Boot 4 moved Mongo connection properties out of
spring.data.mongodb.* into spring.mongodb.* (MongoProperties is now
in org.springframework.boot.mongodb.autoconfigure). The legacy key
was being silently ignored, so the auto-configured client fell back
to localhost:27017 and failed every IT/Fuzz context load.

Signed-off-by: Git-HimanshuRathi <[email protected]>
Spring Boot 4's spring-boot-starter-opentelemetry does not consume the
OTel SDK-autoconfigure SPI the community starter relied on, so the
@bean AutoConfigurationCustomizerProvider in
OtelAutoConfigurationCustomizerProvider was never invoked at runtime
and neither the local span storage processor nor the X-Trace-Id
propagator reached the SDK. The community starter also provided the
WithSpanAspect that wove @WithSpan-annotated methods, which Spring's
official starter does not bundle.

Three targeted changes:

- Drop the dead AutoConfigurationCustomizerProvider bean. Expose
  XTraceIdTextMapPropagator as a plain TextMapPropagator @bean so
  Spring's OpenTelemetryTracingAutoConfiguration composes it via its
  ObjectProvider<TextMapPropagator> aggregation alongside W3C and
  baggage propagators. CustomExplainTraceProcessor is already a
  @component and is picked up the same way through
  ObjectProvider<SpanProcessor>.
- Add a minimal WithSpanAspect (gated by
  otel.instrumentation.annotations.enabled) that opens a span using
  the OpenTelemetry-provided Tracer, makes it current, ends it on
  return, and records exceptions on failure. Pulls in
  spring-boot-starter-aspectj (renamed from spring-boot-starter-aop in
  Boot 4) for AspectJ proxy support.
- Set management.tracing.sampling.probability=1.0 to preserve the
  100 percent sampling the project already configured via the legacy
  otel.traces.sampler.arg=1.0 (which only applied under the SDK-
  autoconfigure pipeline).

Also drops the now-unused opentelemetry-sdk-extension-autoconfigure-spi
dependency.

Signed-off-by: Git-HimanshuRathi <[email protected]>

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks a lot for a huge amount of work! It looks almost good to me even if I have a few questions. Can you check it out please?

@lbroudoux lbroudoux added kind/question kind/task java Pull requests that update Java code labels May 11, 2026
@lbroudoux lbroudoux added this to the 1.15.0 milestone May 11, 2026
JsScriptEngineBinderTest was the only caller and now uses an in-process
HTTP server (b1969c6). Confirmed by grep that no other test references
TestFetchController.

Signed-off-by: Git-HimanshuRathi <[email protected]>
@lbroudoux
lbroudoux merged commit c9d9bac into microcks:master May 12, 2026
12 checks passed
@Heyy-Himanshuu
Heyy-Himanshuu deleted the feat/2053-spring-boot-4 branch May 12, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code kind/task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to Spring Boot 4.0.6

2 participants