springboot不需要重启访问最新的文件

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值