Skip to content

Spring Boot 4 Deprecated Properties You Need to Know

I upgraded to Spring Boot 4 last week, expecting a smooth transition. My build compiled fine, the application started, but then I noticed warnings popping up in my logs about deprecated properties. Some features I relied on were silently failing. That’s when I realized Spring Boot 4 isn’t just about Java 17 - it’s also cleaning house on old APIs.

Let me walk you through what I found and how I fixed it.

The Deprecation Landscape in Spring Boot 4

Spring Boot 4.0 marked several properties and classes for removal. Here’s what’s affected:

Deprecated → Removed Timeline
─────────────────────────────────
4.0.0 → Marked deprecated
4.2.0 → Scheduled for removal
Update NOW to avoid pain

1. HttpMessageConverters - The Legacy Converter API

This was my first issue. I had custom message converters configured the “old way”:

Old
@Bean
public HttpMessageConverters customConverters() {
return new HttpMessageConverters(new MyCustomConverter());
}

The problem? This constructor is deprecated in Spring Boot 4.0:

Old
// These constructors are now deprecated:
new HttpMessageConverters(true, additionalConverters);
new HttpMessageConverters(additionalConverters);
new HttpMessageConverters(additionalConverter1, additionalConverter2);

The new approach splits client and server concerns:

New
@Bean
public ClientHttpMessageConvertersCustomizer clientCustomizer() {
return builder -> builder.add(new MyCustomConverter());
}
New
@Bean
public ServerHttpMessageConvertersCustomizer serverCustomizer() {
return builder -> builder.add(new MyXmlConverter());
}

The key difference is architectural - Spring now distinguishes between client-side (RestTemplate, WebClient) and server-side (Spring MVC) message conversion. This gives you finer control over what converters apply where.

2. Jackson2EndpointAutoConfiguration - Actuator’s Jackson Setup

This one surprised me. I had custom Jackson configuration for my actuator endpoints, and suddenly it wasn’t working the same way.

Old
// Jackson2EndpointAutoConfiguration is deprecated
// since Spring Boot 4.0.0, forRemoval=true

The reason? Spring Boot 4 is moving toward Jackson 3, and this auto-configuration class is tied to Jackson 2 semantics.

If you were using this for custom endpoint serialization, you’ll need to configure Jackson 3 directly through your existing ObjectMapper bean or use Jackson’s native configuration approach.

3. OutputCaptureRule - JUnit 4 to JUnit 5 Migration

I had tests using the old JUnit 4 rule for capturing output:

Old
import org.junit.Rule;
import org.junit.Test;
public class MyTest {
@Rule
public OutputCaptureRule output = new OutputCaptureRule();
@Test
public void test() {
System.out.println("ok");
assertThat(output.getOut()).contains("ok");
}
}

This entire class is deprecated with @Deprecated(forRemoval=true). The replacement is JUnit 5’s extension model:

New
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.system.OutputCaptureExtension;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(OutputCaptureExtension.class)
class MyTest {
@Test
void test(CapturedOutput output) {
System.out.println("ok");
assertThat(output).contains("ok");
}
@AfterEach
void after(CapturedOutput output) {
assertThat(output.getOut()).contains("ok");
assertThat(output.getErr()).contains("error");
}
}

Notice the key differences:

  • @Rule@ExtendWith
  • Field injection → method parameter injection
  • OutputCaptureRuleOutputCaptureExtension

This aligns with Spring Boot’s push toward JUnit 5 as the standard.

4. Jackson2 Locale Configuration

This is more subtle. I found warnings about Jackson2 locale properties in my configuration:

Deprecation: @DeprecatedConfigurationProperty(reason="Deprecated in favor of Jackson 3", since="4.0.0")

The affected Jackson2Properties methods include:

Deprecated
properties.getLocale(); // Deprecated
properties.getDateFormat(); // Deprecated
properties.getTimeZone(); // Deprecated
properties.getSerialization(); // Deprecated
properties.getDeserialization(); // Deprecated

These are all being phased out in favor of Jackson 3’s native configuration. If you have YAML or properties files configuring Jackson through Spring Boot’s prefix (spring.jackson.*), you’ll want to review Jackson 3’s native properties.

Quick Migration Checklist

Here’s what I did to fix my project:

Migration Checklist:
─────────────────────
□ Replace HttpMessageConverters constructors with Customizers
□ Move Jackson2EndpointAutoConfiguration to Jackson 3 config
□ Migrate OutputCaptureRule → OutputCaptureExtension (JUnit 5)
□ Review spring.jackson.* properties for deprecated config
□ Run tests to verify everything still works
□ Check for runtime warnings in logs

Why This Matters

I initially ignored the deprecation warnings, thinking they’d just be cosmetic. But these aren’t minor changes - they’re architectural shifts. The Spring team is using Spring Boot 4 as an opportunity to:

  1. Remove accumulated technical debt
  2. Push toward Jackson 3
  3. Standardize on JUnit 5
  4. Improve separation between client and server HTTP handling

Ignoring these deprecations means your application will break when these APIs are removed in 4.2.0.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments