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.
SmartGymManagementSystem/WebMvcConfig.java

22 lines
828 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 WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 静态资源映射
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/", "classpath:/public/")
.setCachePeriod(0);
// 确保 smart-gym 目录能被访问
registry.addResourceHandler("/smart-gym/**")
.addResourceLocations("classpath:/static/smart-gym/")
.setCachePeriod(0);
}
}