| | |
| | | package com.ycl.jxkg.config.spring.mvc; |
| | | |
| | | import com.ycl.jxkg.config.RuoYiConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.config.spring.wx.TokenHandlerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | |
| | | private final TokenHandlerInterceptor tokenHandlerInterceptor; |
| | | private final SystemConfig systemConfig; |
| | | private final RuoYiConfig ruoYiConfig; |
| | | |
| | | /** |
| | | * Instantiates a new Web mvc configuration. |
| | |
| | | * @param systemConfig the system config |
| | | */ |
| | | @Autowired |
| | | public WebMvcConfiguration(TokenHandlerInterceptor tokenHandlerInterceptor, SystemConfig systemConfig) { |
| | | public WebMvcConfiguration(TokenHandlerInterceptor tokenHandlerInterceptor, SystemConfig systemConfig, RuoYiConfig ruoYiConfig) { |
| | | this.tokenHandlerInterceptor = tokenHandlerInterceptor; |
| | | this.systemConfig = systemConfig; |
| | | this.ruoYiConfig = ruoYiConfig; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | registry.addResourceHandler("/api/files" + "/**") |
| | | .addResourceLocations("file:" + ruoYiConfig.getUrl() + File.separator); |
| | | registry.addResourceHandler("/**") |
| | | .addResourceLocations("classpath:/static/") |
| | | .setCachePeriod(31556926); |