1.新建一个配置文件夹,放配置类
2.编辑
WebMvcConfig.java
package com.southwind.configuration;import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;//配置为配置类注解
@Configuration //继承WebMvcConfigurationSupport
public class WebMvcConfig extends WebMvcConfigurationSupport {@Overrideprotected void addResourceHandlers(ResourceHandlerRegistry registry) {//访问路径 //资源路径registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");}
}
3.重启tomcat