Add debug logging for resource handling in WebConfig.

This commit is contained in:
akastijn 2025-07-31 22:03:34 +02:00
parent 8a839ac922
commit ff1b09be92

View File

@ -1,5 +1,6 @@
package com.alttd.altitudeweb.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@ -11,7 +12,7 @@ import org.springframework.web.servlet.resource.PathResourceResolver;
import java.io.IOException;
@Configuration
@Slf4j @Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
@ -25,9 +26,12 @@ public class WebConfig implements WebMvcConfigurer {
Resource requestedResource = location.createRelative(resourcePath);
if (requestedResource.exists() && requestedResource.isReadable()) {
log.debug("Serving resource {} from {}", resourcePath, location);
return requestedResource;
}
log.debug("Resource {} not found in {}, serving index.html", resourcePath, location);
return new ClassPathResource("/static/browser/index.html");
}
});