| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import java.io.File; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) |
| | | { |
| | | String systemDir=System.getProperty("user.dir"); |
| | | /** 本地文件上传路径 */ |
| | | registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") |
| | | .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); |
| | |
| | | .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic()); |
| | | //文件访问路径 |
| | | registry.addResourceHandler("/uploadfile/**") |
| | | .addResourceLocations("file:" + dcPath); |
| | | .addResourceLocations("file:" + systemDir+ File.separator+dcPath+File.separator); |
| | | } |
| | | |
| | | /** |