diff --git a/Spring-ch14-staticAndCORS/pom.xml b/Spring-ch14-staticAndCORS/pom.xml
index 8907719..e35ea8a 100644
--- a/Spring-ch14-staticAndCORS/pom.xml
+++ b/Spring-ch14-staticAndCORS/pom.xml
@@ -31,4 +31,25 @@
hibernate-validator
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ ${basedir}/web
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 21
+ 21
+ --enable-preview
+
+
+
+
\ No newline at end of file
diff --git a/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/AppConfig.java b/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/AppConfig.java
index 53bed73..9c5ee79 100644
--- a/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/AppConfig.java
+++ b/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/AppConfig.java
@@ -8,4 +8,4 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@EnableWebMvc
@ComponentScan({"com.ycjy.web"})
public class AppConfig {
-}
+}
\ No newline at end of file
diff --git a/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/WebConfig.java b/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/WebConfig.java
index ca3621d..d9a691f 100644
--- a/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/WebConfig.java
+++ b/Spring-ch14-staticAndCORS/src/main/java/com/ycjy/config/WebConfig.java
@@ -1,14 +1,22 @@
package com.ycjy.config;
import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
+// @Override
+// public void addResourceHandlers(ResourceHandlerRegistry registry) {
+// registry.addResourceHandler("/static/**")
+// .addResourceLocations("/static/","classpath:/static/");
+// }
+
+
+ // webappçš„
@Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/static/**")
- .addResourceLocations("/static/","classpath:/static/");
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
}
-}
+}
\ No newline at end of file
diff --git a/Spring-ch14-staticAndCORS/src/test/java/corsTest/index.html b/Spring-ch14-staticAndCORS/src/test/java/corsTest/index.html
new file mode 100644
index 0000000..28d11a0
--- /dev/null
+++ b/Spring-ch14-staticAndCORS/src/test/java/corsTest/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Spring-ch14-staticAndCORS/web/WEB-INF/web.xml b/Spring-ch14-staticAndCORS/web/WEB-INF/web.xml
new file mode 100644
index 0000000..d80081d
--- /dev/null
+++ b/Spring-ch14-staticAndCORS/web/WEB-INF/web.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/Spring-ch14-staticAndCORS/web/static/test.txt b/Spring-ch14-staticAndCORS/web/static/test.txt
new file mode 100644
index 0000000..9d07aa0
--- /dev/null
+++ b/Spring-ch14-staticAndCORS/web/static/test.txt
@@ -0,0 +1 @@
+111
\ No newline at end of file