Learning about static resources

A dynamic application often has static parts as well. SpringWebFlux also enables us to configure static resources. Let's suppose that we want to use bootstrap.css in our Thymeleaf application. In order to do this, we have to enable the server to determine the static content. This can be configured as follows:

public class WebfluxConfig implements WebFluxConfigurer {    //Rest Removed for Brevity    @Override    public void addResourceHandlers(ResourceHandlerRegistry registry) {        registry.addResourceHandler("/resources/**")                .addResourceLocations("classpath:/static/");    }}

In the preceding code, the following has occurred:

  1. The addResourceHandler method takes a URL pattern and configures it to be static locations which ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.