You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
727 B
20 lines
727 B
package com.gym.config;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
@Configuration
|
|
public class StaticResourceConfig implements WebMvcConfigurer {
|
|
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
// 处理 smart-gym 目录
|
|
registry.addResourceHandler("/smart-gym/**")
|
|
.addResourceLocations("classpath:/static/smart-gym/");
|
|
|
|
// 处理根路径
|
|
registry.addResourceHandler("/**")
|
|
.addResourceLocations("classpath:/static/");
|
|
}
|
|
} |