Serving static resources with Spring WebFlux and Kotlin

When you start a WebFlux project you haven’t the support for static resources, like HTML, CSS and JS files, provided by Spring Boot project. Unfortunately how to solve this simple task isn’t so well documented, so I decided to write this post.

The simplest way I found is to define a resource router as you can see below:

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.io.ClassPathResource
import…

--

--

--

Open-space invader, bug hunter and software writer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Davide Cerbo

Davide Cerbo

Open-space invader, bug hunter and software writer

More from Medium

Developing a Multi Data Source Backend Server using Clean Architecture in Kotlin -Part 1

Android 103 : How is constructor injection different from provides method in Dagger?

Kotlin Programming Language: Everything You Need to Know

Springboot Kotlin and Redis — Great partners