Package dev.dokimos.server.config
Class SpaResourceConfig
java.lang.Object
dev.dokimos.server.config.SpaResourceConfig
- All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration
public class SpaResourceConfig
extends Object
implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Serves the single-page React app and forwards client side routes to
index.html so a deep
link or a page refresh on a route such as /traces or /api-keys is handled by the SPA
router instead of returning 404. Real static assets are served directly; only unmatched, non-API
paths fall back to index.html. API, actuator, and OpenAPI paths are left to their
controllers, so an unknown one still returns 404 rather than the app shell.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
addArgumentResolvers, addCorsMappings, addErrorResponseInterceptors, addFormatters, addInterceptors, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
-
Constructor Details
-
SpaResourceConfig
public SpaResourceConfig()
-
-
Method Details
-
addResourceHandlers
public void addResourceHandlers(@NonNull org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) - Specified by:
addResourceHandlersin interfaceorg.springframework.web.servlet.config.annotation.WebMvcConfigurer
-