|
@@ -2,10 +2,17 @@ package com.jkcredit.sysnews.config;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
@Configuration
|
|
|
-public class WebConfiguration {
|
|
|
+public class WebConfiguration implements WebMvcConfigurer {
|
|
|
+ @Value("${photo.accessResource}")
|
|
|
+ private String accessResource;
|
|
|
+ @Value("${photo.veritablePath}")
|
|
|
+ private String veritablePath;
|
|
|
|
|
|
private final Logger log = LoggerFactory.getLogger(WebConfiguration.class);
|
|
|
|
|
@@ -15,17 +22,32 @@ public class WebConfiguration {
|
|
|
this.applicationProperties = applicationProperties;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
+ registry.addResourceHandler(accessResource + "**").addResourceLocations(veritablePath);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ application.properties
|
|
|
+ jkcredit.news.images.upload.path=/home/news/beans/photo
|
|
|
+ jkcredit.news.images.virthr.path=/home/news/beans/photo
|
|
|
+ jkcredit.news.access.url=https:
|
|
|
+ jkcredit.news.access.url=https:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ File mkdir upload.path
|
|
|
+ IMAGE /201.png
|
|
|
+ ${jkcredit.news.access.url}${/app/images}/201.png
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ */
|
|
|
|
|
|
}
|