提交 1afd09b7 编写于 作者: Skyeye云's avatar Skyeye云

路径映射完成

上级 c3612b9c
因为 它太大了无法显示 source diff 。你可以改为 查看blob
package com.skyeye.common.interceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
......@@ -7,6 +8,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration
public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
@Value("${IMAGES_PATH}")
private String IMAGES_PATH;
/**
* 配置静态资源
......@@ -14,6 +18,7 @@ public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("/template/**").addResourceLocations("classpath:/template/");
registry.addResourceHandler("/images/**").addResourceLocations("file:" + IMAGES_PATH);
super.addResourceHandlers(registry);
}
......
......@@ -2,7 +2,7 @@
server.port=8081
#图片路径
IMAGES_PATH=D:/images/
IMAGES_PATH=D:/skyeye/images/
#请求路径url
java.request.url.mappimg=mapping/reqmapping.xml
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册