在springBoot开发过程中,有时我们需要自定义静态文件访问的根目录,这个目录默认情况下是 resourses目录下,那我们可以修改默认静态文件存在的目录。
方式:新建一个配置类 WebConfig,需要继承 WebMvcConfigurerAdapter 默认的适配器类。
代码:
package com.oneapm.medivh.proxy.ai.config;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by zcl on 2017/5/18.
*/
@Setter
@Configuration
pu