Key New Features in Spring Boot 2.6.0

Spring Boot 2.6.0 introduces several important changes such as default prohibition of circular dependencies, custom sanitizing functions, automatic Redis connection‑pool activation, moved reactive session properties, Maven build‑info exclusions, WebTestClient support for MVC testing, and Log4j2 composite configuration options.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
Key New Features in Spring Boot 2.6.0

1. Default Prohibition of Circular Dependencies

The new version disables circular bean references by default; if a circular dependency exists the application will fail to start. Developers can re‑enable it by adding

spring:
  main:
    allow-circular-references: true

to the configuration file.

2. Support for Custom Sanitizing Rules

Spring Boot can now mask sensitive values exposed by the /env and /configprops endpoints. By defining a SanitizingFunction bean, developers can implement custom logic to sanitize specific properties.

@Bean
public SanitizingFunction mobileSanitizingFunction() {
    return data -> {
        PropertySource<?> propertySource = data.getPropertySource();
        if (propertySource.getName().contains("redis.properties")) {
            if (data.getKey().equals("redis.mobile")) {
                return data.withValue(SANITIZED_VALUE);
            }
        }
        return data;
    };
}

3. Redis Connection Pool Enabled by Default

Previously developers had to enable the Redis connection pool manually; now it is turned on automatically. To disable it, set either spring.redis.jedis.pool.enabled = false or spring.redis.lettuce.pool.enabled = false in the properties file.

4. Reactive Server Session Properties

The reactive server now exposes session properties under server.reactive.session instead of the older spring.webflux.session, providing the same options as the servlet‑based configuration.

5. Maven Build‑Info Property Exclusion

Specific properties can be excluded from the build-info.properties generated by the Spring Boot Maven or Gradle plugin. Example to exclude the version property:

<configuration>
    <excludeInfoProperties>
        <excludeInfoProperty>version</excludeInfoProperty>
    </excludeInfoProperties>
</configuration>

6. WebTestClient Support for Spring MVC Testing

Developers can now use WebTestClient to test Spring MVC applications in a mock environment by annotating the test class with @AutoConfigureMockMvc, simplifying test setup.

7. Log4j2 Composite Configuration

Log4j2 now supports composite configurations; the property logging.log4j2.config.override can be used to specify additional configuration files that override the main log configuration.

Summary

The Spring Boot 2.6.0 release brings substantial changes across configuration, security, testing, and logging. For full details, refer to the official release notes at https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.6-Release-Notes.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendjavatestingredisConfigurationSpring BootRelease Notes
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.