Код: Выделить всё
@Configuration
@EnableWebFlux
public class WebConfig implements WebFluxConfigurer
{
@Bean
RouterFunction redirectToIndex()
{
ClassPathResource index = new ClassPathResource("static/index.html");
List extensions = List.of("js", "css", "ico", "png", "jpg", "gif");
RequestPredicate spaPredicate = path("/api/**").or(path("/error"))
.or(pathExtension(extensions::contains))
.negate();
return route().resource(spaPredicate, index).build();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
registry.addResourceHandler("*.html")
.addResourceLocations("classpath*:/static")
.setCacheControl(CacheControl.maxAge(Duration.ofHours(1)));
registry.addResourceHandler("/static/**")
.addResourceLocations("classpath*:/static/")
.setCacheControl(CacheControl.maxAge(Duration.ofHours(1)))
.resourceChain(true)
.addResolver(new EncodedResourceResolver())
.addResolver(new PathResourceResolver());
}
}
Действительно существует static/index.html и static /assets/, но он находится под сторонней зависимостью. У меня такое ощущение, что static/index.html относится к верхнему корню толстой банки. Что я делаю не так?

Подробнее здесь: https://stackoverflow.com/questions/781 ... dependency