-
Notifications
You must be signed in to change notification settings - Fork 40.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Welcome page support in Spring WebFlux #9785
Comments
classpath:/static/index.html
) not being resolved for /
uri
A workaround: import org.springframework.core.io.Resource
import org.springframework.http.MediaType.*
import org.springframework.web.reactive.function.server.ServerResponse.ok
import org.springframework.web.reactive.function.server.router
@Configuration
class ApplicationRoutes {
@Value("classpath:/static/index.html")
private lateinit var indexHtml: Resource
@Bean
fun mainRouter() = router {
GET("/") {
ok().contentType(TEXT_HTML).syncBody(indexHtml)
}
}
} |
Hi! Question on stackoverflow contains workaround: https://stackoverflow.com/questions/45147280/spring-webflux-how-to-forward-to-index-html-to-serve-static-content |
Why not have addViewControllers(ViewControllerRegistry registry) method in WebFluxConfigurer similar to WebMvcConfigurer? |
@sivaprasadreddy |
Waiting for SPR-17389. |
@bclozel
If this behavior is intentional, it should be at least documented. Otherwise it is a bug. |
@jan-peremsky See #21909 |
Prior to this commit, the welcome page support implemented in gh-9785 would override existing index views in both annotation and functional variants. This comes from the fact that the feature was implemented as a `RouterFunction` configured in the main `RouterFunctionMapping` bean. Due to ordering issues between mappings, this would override existing application mappings in some cases. This commit ensures that the welcome page `RouterFunction` is contributed to the context in its own handler mapping, ordered after the application ones. Fixes gh-21909
Totally agreed!
Will next update fix the pollution of |
@bclozel Thanks! Is there any clues about the release time of new version? |
The scheduled release dates are available on GitHub. See https://github.com/spring-projects/spring-boot/milestone/173 |
For a webflux project(using 2.0.0.M2) the welcome page in
classpath:/static/index.html
is not getting resolved for root uri/
and returns a 404 status.However it is served out if I access
/index.html
explicitly.The text was updated successfully, but these errors were encountered: