Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Spring Boot Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-spring-boot-knowledge-patch)
---
name: spring-boot-knowledge-patch
description: Spring Boot
version: "4.2.0"
license: MIT
metadata:
author: Nevaberry
---
# Spring Boot Knowledge Patch
Load this skill when upgrading Spring Boot applications or working on configuration,
web clients, persistence, messaging, security, observability, tests, and build integration.
Use the quick references below for migration decisions and the topic files for full
guidance and examples. Reference attributions distinguish version-specific behavior.
## Topic index
| Reference | Topics |
| --- | --- |
| [Runtime, build, and migration](references/runtime-build-and-migration.md) | Dependencies, removals, native images, Gradle, Maven, OCI images |
| [Configuration and container](references/configuration-and-container.md) | Bean conditions, binding, imports, SpEL, tasks, Compose, service connections |
| [Web and HTTP clients](references/web-and-http-clients.md) | Routing, API versions, HTTP clients, JSON, embedded servers, GraphQL, gRPC, Gateway |
| [Data and messaging](references/data-and-messaging.md) | Repositories, JPA, JDBC, MongoDB, Cassandra, Redis, Pulsar, JMS, RabbitMQ |
| [Security](references/security.md) | Authorization, OAuth 2, JWT, MFA, CSRF, WebAuthn, SAML, TLS |
| [Observability and operations](references/observability-and-operations.md) | Actuator, health, certificates, metrics, tracing, OpenTelemetry, logging |
| [Testing](references/testing.md) | Container properties, test databases, HTTP tests, contexts, bean overrides, AOT |
| [Spring AI](references/spring-ai.md) | Dependencies, ingestion, memory, evaluation, telemetry, MCP |
## Breaking changes and deprecations
### Removed APIs and integration changes
- Before upgrading to Boot 4.1, check APIs and properties deprecated in Boot 4.0:
4.1 removes them. Change layered jar extraction from `layertools` to `tools`.
- Framework 7 drops legacy `javax.annotation` and `javax.inject` support; use
`jakarta.annotation` and `jakarta.inject`. Replace explicit `spring-jcl`
dependencies with Apache Commons Logging 1.3.0; existing Commons Logging API calls work.
- Framework 7 removes `HttpComponentsClientHttpRequestFactory#setConnectTimeout`
overloads and its OkHttp3 integration. Review explicit timeouts and request factories.
- Framework prefers Jackson 3 and falls back to deprecated Jackson 2 support.
Use `tools.jackson` mapper types, retain annotations under
`com.fasterxml.jackson.annotation`, and replace `Jackson2ObjectMapperBuilder`
with a Jackson 3 mapper builder such as `JsonMapper.builder()`.
- Boot 4.2.0 deprecates its Apache Pulsar integration. Boot 4.1 deprecates embedded
Derby support, Dynatrace V1 configuration, and DevTools LiveReload; migrate embedded
Derby applications to H2 or HSQLDB and use Dynatrace V2 configuration.
### Bean selection, executors, and persistence startup
- With `annotation` on a bean method's `@ConditionalOnBean` or
`@ConditionalOnMissingBean`, supply `value` explicitly to preserve return-type criteria.
- Inferred bean conditions now match generic signatures. For a method returning
`Converter<String, Integer>`, use `@ConditionalOnMissingBean(Converter.class)`
to check for any `Converter` as before.
- Use `@Bean(defaultCandidate = false)` for an additional bean of an auto-configured
type that Boot's type-based bean conditions should ignore.
- Configuration processing rejects `void` bean methods and methods annotated with
both `@Bean` and `@Autowired`; declare dependencies as bean-method parameters.
- Move a `REGISTER_BEAN` condition off a configuration class with `@ComponentScan`
and onto the bean definitions it should govern.
- Change named executor references from `taskExecutor` to `applicationTaskExecutor`.
`spring.task.execution.mode=force` keeps Boot's executor with a custom `Executor`
and uses it for integrations including `@Async`; an `AsyncConfigurer` can still select
the executor for `@Async`.
- In Boot 4.1, JPA `deferred` bootstrap requires a suitable `AsyncTaskExecutor` for
the auto-configured entity manager factory and fails without one. In `lazy` mode,
its bootstrap executor is unset by default; configure background initialization with
`spring.jpa.bootstrap`.
### Configuration binding and property migrations
- Add `@Valid` to each nested field that should be validated inside a `@Validated`
configuration properties class; unannotated nested constraints can go unchecked.
- Use `true` or `false` for boolean flags such as `.enabled`.
- Boot 3.4 ignores YAML empty maps such as `feature: {}`. In Boot 4.1 they survive in
the `PropertySource`; constructor binding supports defaults for explicitly empty
properties, and absent `Optional` constructor parameters bind to `Optional.empty()`.
- In 3.5.0, profile names use letters, digits, hyphens, and underscores, starting and
ending with a letter or digit. The relaxation for `.`, `+`, and `@` and the
`spring.profiles.validate=false` opt-out arrive in 3.5.1.
| Previous setting | Replacement |
| --- | --- |
| `spring.graphql.path` | `spring.graphql.http.path` |
| `spring.graphql.sse.timeout` | `spring.graphql.http.sse.timeout` |
| `spring.mvc.converters.preferred-json-mapper` | `spring.http.converters.preferred-json-mapper` |
| `spring.codec.log-request-details` | `spring.http.codecs.log-request-details` |
| `spring.codec.max-in-memory-size` | `spring.http.codecs.max-in-memory-size` |
| `spring.dao.exceptiontranslation.enabled` | `spring.persistence.exceptiontranslation.enabled` |
| `management.tracing.enabled` | `management.tracing.export.enabled` |
Also replace `@ConditionalOnEnabledTracing` with `@ConditionalOnEnabledTracingExport`.
Update `EnvironmentPostProcessor` imports and factory registration keys to
`org.springframework.boot.EnvironmentPostProcessor`; the old
`org.springframework.boot.env.EnvironmentPostProcessor` interface is deprecated.
### HTTP execution, routing, and security migration
- `RestClient.retrieve()` sends a request only at a terminal `ResponseSpec` operation.
Call `toBodilessEntity()` to send it and discard the body.
- Apache HttpClient's HTTP/1.1 upgrade behavior can fail through Envoy or Istio.
If affected, use the request factory builder customization in the web reference to
set `setProtocolUpgradeEnabled(false)`.
- Boot-configured `WebClient` follows redirects by default. `TestRestTemplate`
inherits `RestTemplate` redirect settings; replace `HttpOption.ENABLE_REDIRECTS`
with `withRedirects(…)`.
- Gateway Server disables `Forwarded` and `X-Forwarded-*` handling by default.
Set `trusted-proxies` under the appropriate server prefix to a Java regular
expression matching trusted proxies. The web reference lists artifact and prefix moves.
- Implement `AuthorizationManager.authorize` instead of `check`; use
`PathPatternRequestMatcher` instead of removed `MvcRequestMatcher` and `AntPathRequestMatcher`.
- For SAML, upgrade to OpenSAML 5 and use `AssertingPartyMetadata` in place of APIs
based on `AssertingPartyDetails`. `Saml2AuthenticationTokenConverter` no longer accepts GET.
- Mail auto-configuration enables SSL hostname verification in Boot 4.0.7. Use a
server hostname matching its certificate.
## Actuator, tracing, and operational controls
Use `management.endpoints.access.default` and `management.endpoint.<id>.access`
with `none`, `read-only`, or `unrestricted`. Set `defaultAccess` on custom endpoints.
`management.endpoints.access.max-permitted=read-only` caps even explicitly unrestricted
endpoints. Heapdump defaults to `none`; enabling it over HTTP requires both settings:
```properties
management.endpoints.web.exposure.include=heapdump
management.endpoint.heapdump.access=unrestricted
```
Set `management.otlp.tracing.transport=grpc` for gRPC span export; HTTP is the default.
`management.otlp.tracing.export.enabled=false` disables only the OTLP trace exporter.
`management.otlp.logging.export.enabled=false` disables OTLP logs, while
`management.logging.export.enabled=false` disables log export globally.
`management.opentelemetry.enabled=false` uses no-op SDK providers while keeping
propagation. Boot property resource attributes take precedence over
`OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME`; `spring.application.group`
supplies `service.namespace`, replacing the deprecated `service.group` attribute.
SSL health uses `management.health.ssl.certificate-validity-warning-threshold` for
the warning window. In Boot 4.0, otherwise-valid certificates within that window show
`VALID`, replacing `WILL_EXPIRE_SOON`; inspect `details.expiringChains` for upcoming
expirations. Invalid certificates cause SSL health to report `OUT_OF_SERVICE`.
## Common configuration and integration features
### Imports, tasks, and HTTP services
- Use `spring.config.import=env:MY_CONFIGURATION` for properties or YAML in a
multiline environment variable. An import such as
`classpath:import.properties[encoding=utf-8]` overrides the ISO-8859-1 default for
imported `.properties` files.
- Boot composes multiple `TaskDecorator` beans into `CompositeTaskDecorator` for
auto-configured executors and schedulers; use `@Order` or `Ordered` to control order.
- Configure API versioning with `spring.mvc.apiversion.*` or `spring.webflux.apiversion.*`;
customize with `ApiVersionResolver`, `ApiVersionParser`, or `ApiVersionDeprecationHandler`.
- Register HTTP interface groups using `@ImportHttpServices` and customize their
clients with `RestClientHttpServiceGroupConfigurer`.
- Use `spring.http.clients.cookie-handling` for auto-configured HTTP clients;
`TestRestTemplate` provides `withCookieHandling` for an override. In 4.1.2, this
property also applies to the reactive HttpComponents connector.
- Configure `InetAddressFilter` to block disallowed IP addresses in blocking and
reactive HTTP clients.
- Boot supports gRPC clients and servers with standalone Netty or Servlet HTTP/2
integration. In 4.1.2, user client customizations take precedence over conflicting
Boot properties, load-balancing configuration binds even when child policies are
omitted, and service configuration durations preserve fractional seconds.
### Data access and messaging
- When `spring.data.redis.url` is set, put the database index in that URL. Boot
ignores `spring.data.redis.database` and selects database 0 if the URL has no index.
- Use `spring.datasource.connection-fetch=lazy` to wrap the auto-configured pooled
data source in `LazyConnectionDataSourceProxy`; physical acquisition waits for the
first JDBC statement.
- `spring-boot-batch-data-mongo` provides MongoDB-backed Spring Batch auto-configuration.
Set `spring.batch.data.mongo.schema.initialize=true` for startup schema initialization
using the built-in schema or a custom newline-delimited JSON script.
- Boot discovers `@RedisListener` endpoints and supplies a default
`RedisMessageListenerContainer` when none exists; configure it under
`spring.data.redis.listener.*`.
- Configure RabbitMQ Streams TLS with `spring.rabbitmq.stream.ssl.enabled=true` or
`spring.rabbitmq.stream.ssl.bundle`. Enable `rabbitmq_stream`; expose port `5552`
with Testcontainers and use `@ServiceConnection(type = RabbitStreamConnectionDetails.class)`,
or publish container port `5552` with Compose.
### Tests and builds
- Replace `DynamicPropertyRegistry` injection into container bean methods with a
separate `DynamicPropertyRegistrar` bean that receives the container. Temporary
`spring.testcontainers.dynamic-property-registry-injection=warn` permits injection
with a warning; `allow` permits it silently.
- `@AutoConfigureTestDatabase` can retain detected container-backed databases without
`replace = Replace.NONE`; `replace = Replace.AUTO_CONFIGURED` explicitly replaces
auto-configured data sources.
- Boot's injected `RestTestClient` uses `MockMvc` with `@AutoConfigureMockMvc`, or the
running server for `@SpringBootTest` on a defined or random port.
- Add `@AutoConfigureWebServer` when a test needs the embedded web server factory bean.
- Use `-Dmaven.test.skip=true` to skip Maven test AOT processing; `-DskipTests` alone
leaves it enabled.
- Pass `--environment` to `bootBuildImage` once per variable; command-line values
override matching build-script values.
### Spring AI
Use `DocumentReader` adapters for vector-store ingestion. `MessageWindowChatMemory`
keeps recent messages and delegates persistence to `ChatMemoryRepository` implementations
for JDBC, Cassandra, or Neo4j; `VectorStoreChatMemoryAdvisor` retrieves similar past
messages. Use `RelevancyEvaluator` for question/context relevance and
`FactCheckingEvaluator` to check document support for a claim.
The MCP client and server starter families support stdio or HTTP Server-Sent Events;
servers expose `@Tool` methods. Use Spring Security and Spring Authorization Server
for OAuth 2 authorization of MCP requests. See the Spring AI reference for dependencies
and the migration recipe.