Refactor project structure and update configurations for improved resource handling

This commit is contained in:
liosha84
2025-06-28 21:15:08 +03:00
parent 5dc79438b7
commit 5fce34dfb8
12 changed files with 63 additions and 31 deletions
@@ -2,10 +2,13 @@ package com.jambotronGroup.jambotron.configuretions;
import org.springframework.beans.factory.annotation.Value;
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 {
@Value("${spring.resources.static-locations}")
String resourceLocations;
@@ -13,7 +16,10 @@ public class MvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//registry.addResourceHandler("/public/**").addResourceLocations(resourceLocations);
// registry.addResourceHandler("/media/**").addResourceLocations("resources/main/public/media/");
registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/");
//registry.
registry.addResourceHandler("/media/**").addResourceLocations("resources/main/public/media/");
}
}
}*/
@@ -15,7 +15,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
/*
@ControllerAdvice
public class NotFoundHandler {
@Value("${spa.default-file}")
@@ -0,0 +1,12 @@
package com.jambotronGroup.jambotron.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/*@Controller
public class RedirectController {
@RequestMapping(value = "/{path:[^\\.]*}")
public String redirect() {
return "forward:/index.html";
}
}*/
@@ -106,6 +106,7 @@ public class WebSecurityConfig {// extends WebSecurityConfigurerAdapter {
auth.requestMatchers("/api/auth/**").permitAll()
.requestMatchers("/*", "/home", "/resources/**").permitAll()
.requestMatchers("/resources/public/media/**").permitAll()
.requestMatchers("/resources/public/browser/**").permitAll()
.requestMatchers("/media/**").permitAll()
.requestMatchers("/api/test/**").permitAll()
.requestMatchers("/api/tutorials").permitAll()