Added route to serve static resources with prepended baseUrl (#19)

This commit is contained in:
Francesco 2023-10-20 14:57:25 +02:00
parent 6f9f567f6e
commit 31200ad64f

View File

@ -0,0 +1,22 @@
package tech.ailef.dbadmin.external;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
@Autowired
private DbAdminProperties properties;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
System.out.println("ADDING");
registry.addResourceHandler("/" + properties.getBaseUrl() + "/**")
.addResourceLocations("classpath:/static/");
}
}