Spring Framework 6.2.0-M4 available now

Releases | Brian Clozel | June 13, 2024 | ...

We are happy to announce the availability of the fourth milestone of Spring Framework 6.2. We shipped quite a few features since our last M3 release.

Spring Framework 6.2.0-M4 is available from repo.spring.io/milestone now, check out the detailed release notes for this version.

Core and Testing

The Task and ScheduledTask types now expose metadata about their execution: last execution time and outcome, next scheduled execution time...

We also made further refinements for the new @TestBean and @MockitoBean support. You can read our reference documentation to see this feature in action.

Web and Messaging

@ExceptionHandler methods are now more flexible as they support content negotiation during the error handling phase. This means that you can tailor error handling depending on the content type requested by the HTTP client.

Here's a code snippet showing this feature in action:

@ExceptionHandler(produces = "application/json")
public ResponseEntity<ErrorMessage> handleJson(IllegalArgumentException exc) {
	return ResponseEntity.badRequest().body(new ErrorMessage(exc.getMessage(), 42));
}

@ExceptionHandler(produces = "text/html")
public String handle(IllegalArgumentException exc, Model model) {
	model.addAttribute("error", new ErrorMessage(exc.getMessage(), 42));
	return "errorView";
}

Here, automated clients will get a JSON response, while browsers will display an HTML error page with custom messages.

The community requested the following enhancements - and they're now available!

6.2 features recap

Check out our What's New page for details about the new features available at this point.

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all