whycxzp
2021-01-11 15152da2f87438747c519adcb6237093b34ae2b4
src/main/java/com/whyc/Application.java
@@ -3,10 +3,14 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
 * @Description : 启动类
@@ -14,19 +18,12 @@
 **/
@SpringBootApplication
@EnableWebMvc
@ServletComponentScan(basePackages = "com.whyc.filter")
@ServletComponentScan(basePackages = {"com.whyc.filter","com.whyc.servlet"})
@EnableCaching
public class Application extends WebMvcConfigurerAdapter  implements WebMvcConfigurer {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //super.addResourceHandlers(registry);
        //registry.addResourceHandler("/**").addResourceLocations("/");
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}