Skip to content

4.0.0

Compare
Choose a tag to compare
@wimdeblauwe wimdeblauwe released this 29 Nov 07:09
· 5 commits to main since this release

What's Changed

  • docs: Add links to the corresponding README.md for each released version by @wimdeblauwe in #151
  • [fix] Annotations on exception handler methods do not work by @xhaggi in #153
  • Upgrade to Spring Boot 3.4.0, remove deprecated code and mark HtmxView as deprecated by @xhaggi in #152

Upgrade notes

Spring Boot 3.4.0 baseline

This version uses Spring Boot 3.4.0 as the baseline to work with. Be sure to first update your Spring Boot version before updating this library.

HtmxView is deprecated

HtmxView was introduced in this library to make it possible to support Out of Band Swaps. However, in Spring Framework 6.2 (Which is part of Spring Boot 3.4.0) there is now support for HTML Fragments.

As an example, this kind of code:

@HxRequest
@GetMapping("/users")
public HtmxResponse getMainAndPartial(Model model){
    model.addAttribute("users", userRepository.findAll());
    model.addAttribute("count", userRepository.count());
    return HtmxResponse.builder()
        .view("users/list")
        .view("users/count")
        .build();
}

Should be replaced with:

@HxRequest
@GetMapping("/users")
public View users(Model model) {
    model.addAttribute("users", userRepository.findAll());
    model.addAttribute("count", userRepository.count());

    return FragmentsRendering
            .with("users/list")
            .fragment("users/count")
            .build();
}

or

@HxRequest
@GetMapping("/users")
public Collection<ModelAndView> users() {
    return List.of(
            new ModelAndView("users/list", Map.of("users", userRepository.findAll())),
            new ModelAndView("users/count", Map.of("count", userRepository.count()))
    );
}

Full Changelog: 3.6.2...4.0.0