CustomServletConfig ( static 경로 매칭 )
페이지 정보
본문
package web.config;
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 CustomServletConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/js/**")
.addResourceLocations("classpath:/static/js/");
registry.addResourceHandler("/img/**")
.addResourceLocations("classpath:/static/img/");
registry.addResourceHandler("/css/**")
.addResourceLocations("classpath:/static/css/");
registry.addResourceHandler("/assets/**")
.addResourceLocations("classpath:/static/assets/");
registry.addResourceHandler("/fonts/**")
.addResourceLocations("classpath:/static/fonts/");
}
}
- 이전글SwaggerConfig ( 스프링부트 3버전 ) 24.06.19
- 다음글● 수정, 삭제 화면 처리와 설정 24.06.19
댓글목록
등록된 댓글이 없습니다.