From bc56530307e0e92b94a1abb5d38368f04b92e990 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 12 三月 2026 15:52:15 +0800
Subject: [PATCH] 1
---
zy-acs-hex/src/main/java/com/zy/acs/hex/config/WebMvcConfig.java | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/WebMvcConfig.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/config/WebMvcConfig.java
index 5cb4541..ff35e3d 100644
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/WebMvcConfig.java
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/config/WebMvcConfig.java
@@ -3,7 +3,6 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
-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;
@@ -36,28 +35,28 @@
@Bean
public AsyncHandlerInterceptor getAsyncHandlerInterceptor() {
- return new AsyncHandlerInterceptor(){
+ return new AsyncHandlerInterceptor() {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
- cors(response);
+ cors(response);
return true;
}
};
}
-
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 閰嶇疆闈欐�佽祫婧愬鐞嗗櫒
registry.addResourceHandler("/static/**")
+ .addResourceLocations("classpath:/static/")
.addResourceLocations("/static/");
// 閰嶇疆瑙嗗浘鏂囦欢澶勭悊鍣�
registry.addResourceHandler("/views/**")
.addResourceLocations("/views/");
}
- public static void cors(HttpServletResponse response){
+ public static void cors(HttpServletResponse response) {
// 璺ㄥ煙璁剧疆
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Origin", "*");
--
Gitblit v1.9.1