From 92d5b11ee5a0dc7d9af4642d418f15fa8b6e9153 Mon Sep 17 00:00:00 2001
From: Mercy
* // Create and publish the event when a bean's property changes * BeanPropertyChangedEvent event = new BeanPropertyChangedEvent(myBean, "status", oldStatus, newStatus); From 2e1b82c4996574e9ac22be8e6e2f155425c50659 Mon Sep 17 00:00:00 2001 From: MercyDate: Thu, 23 Oct 2025 10:01:03 +0800 Subject: [PATCH 2/7] Migrate javax.servlet references to jakarta.servlet Updated all Javadoc and code references from javax.servlet to jakarta.servlet to align with the latest Servlet API package. Also fixed equals() to compare kind and added kind to JSON output for improved serialization. --- .../web/metadata/WebEndpointMapping.java | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java b/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java index 2e16816a3..222f62332 100644 --- a/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java +++ b/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java @@ -64,8 +64,8 @@ /** * The meta-data class for Web Endpoint Mapping that could be one of these endpoints: * - *
- {@link javax.servlet.Servlet Servlet}
- *- {@link javax.servlet.Filter Servlet's Filter}
+ *- {@link jakarta.servlet.Servlet Servlet}
+ *- {@link jakarta.servlet.Filter Servlet's Filter}
*- Spring WebMVC {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
*- Spring WebFlux {@link org.springframework.web.reactive.DispatcherHandler DispatcherHandler}
*- Customized
@@ -74,8 +74,8 @@ * The method {@link #getKind()} can be used to identify the kind of endpoints, and the method * {@link #getEndpoint()} is an abstract presentation of actual endpoint that may be : *- *
- {@link javax.servlet.ServletRegistration#getName() the name of Servlet}
- *- {@link javax.servlet.FilterRegistration#getName() the name of Servlet's Filter}
+ *- {@link jakarta.servlet.ServletRegistration#getName() the name of Servlet}
+ *- {@link jakarta.servlet.FilterRegistration#getName() the name of Servlet's Filter}
*- the any handler of Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}: *
*
- The {@link String} presenting the name of Handler bean
@@ -95,17 +95,17 @@ ** The method {@link #getSource()} can trace the source of {@link WebEndpointMapping} if present, it could be : *
- *
, or it's {@link #UNKNOWN_SOURCE non-source} * * @param- {@link javax.servlet.ServletContext ServletContext}
+ *- {@link jakarta.servlet.ServletContext ServletContext}
*- Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}
*- Spring WebFlux {@link org.springframework.web.reactive.HandlerMapping}
*the type of endpoint * @author Mercy - * @see javax.servlet.ServletRegistration - * @see javax.servlet.FilterRegistration - * @see javax.servlet.annotation.WebServlet - * @see javax.servlet.annotation.WebFilter + * @see jakarta.servlet.ServletRegistration + * @see jakarta.servlet.FilterRegistration + * @see jakarta.servlet.annotation.WebServlet + * @see jakarta.servlet.annotation.WebFilter * @see org.springframework.web.servlet.DispatcherServlet * @see org.springframework.web.reactive.DispatcherHandler * @see org.springframework.web.servlet.HandlerMapping @@ -170,12 +170,12 @@ public class WebEndpointMapping { public enum Kind { /** - * {@link javax.servlet.Servlet} + * {@link jakarta.servlet.Servlet} */ SERVLET, /** - * {@link javax.servlet.Filter} + * {@link jakarta.servlet.Filter} */ FILTER, @@ -1233,8 +1233,8 @@ private WebEndpointMapping() { /** * The kind of endpoint: * - *
- {@link javax.servlet.Servlet Servlet}
- *- {@link javax.servlet.Filter Servlet's Filter}
+ *- {@link jakarta.servlet.Servlet Servlet}
+ *- {@link jakarta.servlet.Filter Servlet's Filter}
*- Spring WebMVC {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
*- Spring WebFlux {@link org.springframework.web.reactive.DispatcherHandler DispatcherHandler}
*- Customized
@@ -1250,8 +1250,8 @@ public Kind getKind() { /** * The abstract presentation of actual endpoint that may be : *- *
- {@link javax.servlet.ServletRegistration#getName() the name of Servlet}
- *- {@link javax.servlet.FilterRegistration#getName() the name of Servlet's Filter}
+ *- {@link jakarta.servlet.ServletRegistration#getName() the name of Servlet}
+ *- {@link jakarta.servlet.FilterRegistration#getName() the name of Servlet's Filter}
*- the any handler of Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}: *
*
- The {@link String} presenting the name of Handler bean
@@ -1297,7 +1297,7 @@ public boolean isNegated() { /** * The source of {@link WebEndpointMapping} if present, it could be : *- *
, or it's {@link #UNKNOWN_SOURCE non-source} @@ -1362,7 +1362,8 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WebEndpointMapping that = (WebEndpointMapping) o; - return this.negated == that.negated + return this.kind == that.kind + && this.negated == that.negated && arrayEquals(patterns, that.patterns) && arrayEquals(methods, that.methods) && arrayEquals(params, that.params) @@ -1418,6 +1419,7 @@ public String toString() { public String toJSON() { StringBuilder stringBuilder = new StringBuilder(LEFT_CURLY_BRACE).append(LINE_SEPARATOR); append(stringBuilder, "id", this.id); + append(stringBuilder, "kind", this.kind, COMMA, LINE_SEPARATOR); append(stringBuilder, "negated", this.negated, COMMA, LINE_SEPARATOR); append(stringBuilder, "patterns", this.patterns, COMMA, LINE_SEPARATOR); append(stringBuilder, "methods", this.methods, COMMA, LINE_SEPARATOR); @@ -1438,6 +1440,11 @@ private void append(StringBuilder appendable, String name, boolean value, String JSONUtils.append(appendable, name, value); } + private void append(StringBuilder appendable, String name, Kind kind, String... prefixes) { + append(prefixes, appendable); + JSONUtils.append(appendable, name, kind); + } + private void append(StringBuilder appendable, String name, String[] values, String... prefixes) { if (isEmpty(values)) { return; @@ -1451,4 +1458,4 @@ private void append(String[] values, StringBuilder appendable) { appendable.append(values[i]); } } -} +} \ No newline at end of file From 539397f302e22dba9957779eb54be084559494dc Mon Sep 17 00:00:00 2001 From: Mercy- {@link javax.servlet.ServletContext ServletContext}
+ *- {@link jakarta.servlet.ServletContext ServletContext}
*- Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}
*- Spring WebFlux {@link org.springframework.web.reactive.HandlerMapping}
*Date: Thu, 23 Oct 2025 10:01:06 +0800 Subject: [PATCH 3/7] Add 'kind' field to web mapping descriptor Introduced a new 'kind' field with value 'CUSTOMIZED' in the web-mapping-descriptor.json for test resources. This may be used to distinguish mapping types in tests. --- .../src/test/resources/META-INF/web-mapping-descriptor.json | 1 + 1 file changed, 1 insertion(+) diff --git a/microsphere-spring-web/src/test/resources/META-INF/web-mapping-descriptor.json b/microsphere-spring-web/src/test/resources/META-INF/web-mapping-descriptor.json index a053994df..39088cce1 100644 --- a/microsphere-spring-web/src/test/resources/META-INF/web-mapping-descriptor.json +++ b/microsphere-spring-web/src/test/resources/META-INF/web-mapping-descriptor.json @@ -1,5 +1,6 @@ { "id":1, +"kind":"CUSTOMIZED", "negated":true, "patterns":["/a","/b","/c"], "methods":["GET","POST"], From dca2840cfa9a523272af80555f353587cc475e21 Mon Sep 17 00:00:00 2001 From: Mercy Date: Mon, 27 Oct 2025 14:17:15 +0800 Subject: [PATCH 4/7] Bump project version to 0.1.4-SNAPSHOT Updated the property in pom.xml to prepare for the next development iteration. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45daa9db6..3bd81c5e5 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ - 0.1.3-SNAPSHOT +0.1.4-SNAPSHOT From 034732609e852fec6792814687b62e025bf91af0 Mon Sep 17 00:00:00 2001 From: Mercy Date: Mon, 27 Oct 2025 14:17:26 +0800 Subject: [PATCH 5/7] Update latest version for 0.1.x branch in README Bump the documented latest version of the 0.1.x branch from 0.1.3 to 0.1.4 to reflect the most recent release. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 389b73225..6e133769d 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ The easiest way to get started is by adding the Microsphere Spring BOM (Bill of | **Branches** | **Purpose** | **Latest Version** | |--------------|------------------------------------------------|--------------------| -| **0.2.x** | Compatible with Spring Framework 6.0.x - 6.2.x | 0.2.3 | -| **0.1.x** | Compatible with Spring Framework 4.3.x - 5.3.x | 0.1.3 | +| **0.2.x** | Compatible with Spring Framework 6.0.x - 6.2.x | 0.2.4 | +| **0.1.x** | Compatible with Spring Framework 4.3.x - 5.3.x | 0.1.4 | Then add the specific modules you need: From 6c1fa949995c6f81ee82d7dc06c6dac6a02dbd1c Mon Sep 17 00:00:00 2001 From: Mercy Date: Mon, 27 Oct 2025 14:26:25 +0800 Subject: [PATCH 6/7] Replace jakarta.servlet references with javax.servlet Updated all Javadoc references from jakarta.servlet to javax.servlet to ensure compatibility with environments using javax.servlet APIs. No functional code changes were made. --- .../web/metadata/WebEndpointMapping.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java b/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java index 222f62332..5c51e781a 100644 --- a/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java +++ b/microsphere-spring-web/src/main/java/io/microsphere/spring/web/metadata/WebEndpointMapping.java @@ -64,8 +64,8 @@ /** * The meta-data class for Web Endpoint Mapping that could be one of these endpoints: * - *
- {@link jakarta.servlet.Servlet Servlet}
- *- {@link jakarta.servlet.Filter Servlet's Filter}
+ *- {@link javax.servlet.Servlet Servlet}
+ *- {@link javax.servlet.Filter Servlet's Filter}
*- Spring WebMVC {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
*- Spring WebFlux {@link org.springframework.web.reactive.DispatcherHandler DispatcherHandler}
*- Customized
@@ -74,8 +74,8 @@ * The method {@link #getKind()} can be used to identify the kind of endpoints, and the method * {@link #getEndpoint()} is an abstract presentation of actual endpoint that may be : *- *
- {@link jakarta.servlet.ServletRegistration#getName() the name of Servlet}
- *- {@link jakarta.servlet.FilterRegistration#getName() the name of Servlet's Filter}
+ *- {@link javax.servlet.ServletRegistration#getName() the name of Servlet}
+ *- {@link javax.servlet.FilterRegistration#getName() the name of Servlet's Filter}
*- the any handler of Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}: *
*
- The {@link String} presenting the name of Handler bean
@@ -95,17 +95,17 @@ ** The method {@link #getSource()} can trace the source of {@link WebEndpointMapping} if present, it could be : *
- *
, or it's {@link #UNKNOWN_SOURCE non-source} * * @param- {@link jakarta.servlet.ServletContext ServletContext}
+ *- {@link javax.servlet.ServletContext ServletContext}
*- Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}
*- Spring WebFlux {@link org.springframework.web.reactive.HandlerMapping}
*the type of endpoint * @author Mercy - * @see jakarta.servlet.ServletRegistration - * @see jakarta.servlet.FilterRegistration - * @see jakarta.servlet.annotation.WebServlet - * @see jakarta.servlet.annotation.WebFilter + * @see javax.servlet.ServletRegistration + * @see javax.servlet.FilterRegistration + * @see javax.servlet.annotation.WebServlet + * @see javax.servlet.annotation.WebFilter * @see org.springframework.web.servlet.DispatcherServlet * @see org.springframework.web.reactive.DispatcherHandler * @see org.springframework.web.servlet.HandlerMapping @@ -170,12 +170,12 @@ public class WebEndpointMapping { public enum Kind { /** - * {@link jakarta.servlet.Servlet} + * {@link javax.servlet.Servlet} */ SERVLET, /** - * {@link jakarta.servlet.Filter} + * {@link javax.servlet.Filter} */ FILTER, @@ -1233,8 +1233,8 @@ private WebEndpointMapping() { /** * The kind of endpoint: * - *
- {@link jakarta.servlet.Servlet Servlet}
- *- {@link jakarta.servlet.Filter Servlet's Filter}
+ *- {@link javax.servlet.Servlet Servlet}
+ *- {@link javax.servlet.Filter Servlet's Filter}
*- Spring WebMVC {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
*- Spring WebFlux {@link org.springframework.web.reactive.DispatcherHandler DispatcherHandler}
*- Customized
@@ -1250,8 +1250,8 @@ public Kind getKind() { /** * The abstract presentation of actual endpoint that may be : *- *
- {@link jakarta.servlet.ServletRegistration#getName() the name of Servlet}
- *- {@link jakarta.servlet.FilterRegistration#getName() the name of Servlet's Filter}
+ *- {@link javax.servlet.ServletRegistration#getName() the name of Servlet}
+ *- {@link javax.servlet.FilterRegistration#getName() the name of Servlet's Filter}
*- the any handler of Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}: *
*
- The {@link String} presenting the name of Handler bean
@@ -1297,7 +1297,7 @@ public boolean isNegated() { /** * The source of {@link WebEndpointMapping} if present, it could be : *- *
, or it's {@link #UNKNOWN_SOURCE non-source} From 7928180e8373e3e815c7ef980e0e8f84120c6fbc Mon Sep 17 00:00:00 2001 From: Mercy- {@link jakarta.servlet.ServletContext ServletContext}
+ *- {@link javax.servlet.ServletContext ServletContext}
*- Spring WebMVC {@link org.springframework.web.servlet.HandlerMapping}
*- Spring WebFlux {@link org.springframework.web.reactive.HandlerMapping}
*Date: Mon, 27 Oct 2025 14:30:59 +0800 Subject: [PATCH 7/7] Add test for equals with different kinds in WebEndpointMappingTest Added an assertion to verify that WebEndpointMapping objects with different kinds are not equal. This improves test coverage for the equals method. --- .../spring/web/metadata/WebEndpointMappingTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/microsphere-spring-web/src/test/java/io/microsphere/spring/web/metadata/WebEndpointMappingTest.java b/microsphere-spring-web/src/test/java/io/microsphere/spring/web/metadata/WebEndpointMappingTest.java index 798be2f98..ac7f0cb1e 100644 --- a/microsphere-spring-web/src/test/java/io/microsphere/spring/web/metadata/WebEndpointMappingTest.java +++ b/microsphere-spring-web/src/test/java/io/microsphere/spring/web/metadata/WebEndpointMappingTest.java @@ -519,6 +519,9 @@ public void testEquals() { assertNotEquals(mapping, null); assertNotEquals(mapping, this); + // equals with different kinds + assertNotEquals(mapping, minBuilder(FILTER).build()); + // equals with different patterns assertNotEquals(mapping, minServletBuilder().pattern("/**").build());