Tip
1.如果有拦截器,请开放该接口
2.项目启动时会调用该接口
3.请求的连接 http://localhost:8848/files/test.png
应用场景:
发起请求/files/**,访问文件的目录下的路径。
package com.fusdom.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @创建人: giao
* @创建时间: 2020/8/4
* @描述: 解决跨域问题
*/
//@Configuration注解
@Configuration
//实现WebMvcConfigurer
public class CrossDomainConfig implements WebMvcConfigurer {
//重写addCorsMappings方法
@Override
public void addCorsMappings(Cor