Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Xb2555
Copy link
Contributor

@Xb2555 Xb2555 commented Dec 17, 2025

Ⅰ. Describe what this PR did

  • Set the JDK version of the console and namingserver modules to 25 to support Springboot 3.5 and Spring-AI dependencies, preparing for the launch of the MCP function in the future.
  • As the Springboot version has been upgraded from 2.7 to 3.5, most classes have been migrated from the javax package to the Jakarta package, with minor code changes.
  • In the ConsoleRemotingFilter of the namingserver, since AsyncRestTemplate has been deprecated, virtual threads in JDK 21 and above and RestTemplate are used to implement the original asynchronous forwarding + lightweight blocking function, which is more lightweight and usable.
  • The WebSecurityConfig configuration class in the Console module has also been changed to the configuration method of the new version of SpringSecurity.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Xb2555 and others added 26 commits December 2, 2025 18:49
… plus RestTemplate to implement the function
# Conflicts:
#	.github/workflows/build.yml
# Conflicts:
#	namingserver/src/test/java/org/apache/seata/namingserver/NamingControllerTest.java
#	pom.xml
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.11%. Comparing base (a72d265) to head (cd3b4ac).
⚠️ Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7870      +/-   ##
============================================
- Coverage     71.12%   71.11%   -0.01%     
  Complexity      797      797              
============================================
  Files          1294     1294              
  Lines         49528    49528              
  Branches       5873     5873              
============================================
- Hits          35228    35224       -4     
- Misses        11390    11398       +8     
+ Partials       2910     2906       -4     

see 9 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the namingserver and console modules to JDK 25 and Spring Boot 3.5.2, completing a major framework modernization that enables future AI features through the spring-ai module. The upgrade involves migrating from the javax namespace to jakarta, replacing deprecated async APIs with virtual threads, and updating Spring Security configuration to the latest patterns.

Key Changes

  • Upgraded from JDK 8 to JDK 25 and Spring Boot 2.7.18 to 3.5.2 across console and namingserver modules
  • Replaced deprecated AsyncRestTemplate with RestTemplate + virtual threads (JDK 21+) for lightweight asynchronous processing
  • Migrated Spring Security configuration from deprecated WebSecurityConfigurerAdapter to SecurityFilterChain bean approach

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
namingserver/pom.xml Updated JDK version to 25, Spring Boot to 3.5.2, Tomcat to 11.0.2, and migrated from httpclient 4.x to httpclient5
console/pom.xml Updated Spring Boot to 3.5.2, added spring-ai-starter-mcp-server-webmvc dependency for future MCP functionality
namingserver/src/main/java/org/apache/seata/namingserver/filter/ConsoleRemotingFilter.java Replaced AsyncRestTemplate with virtual threads + RestTemplate, implementing async forwarding with CompletableFuture and timeout handling
namingserver/src/main/java/org/apache/seata/namingserver/config/WebConfig.java Updated HTTP client configuration to use httpclient5 packages, removed AsyncRestTemplate bean
console/src/main/java/org/apache/seata/console/config/WebSecurityConfig.java Migrated from WebSecurityConfigurerAdapter to SecurityFilterChain bean pattern with lambda DSL configuration
console/src/main/java/org/apache/seata/console/filter/JwtAuthenticationTokenFilter.java Migrated from javax.servlet to jakarta.servlet, minor code style improvements
namingserver/src/main/resources/application.yml Added ant_path_matcher configuration to maintain compatibility with legacy Ant-style path patterns
Multiple test files Updated imports from javax.servlet to jakarta.servlet for Spring Boot 3.x compatibility
.github/workflows/codeql-analysis.yml Added Java 25 setup to ensure CI builds with the new JDK version
Comments suppressed due to low confidence (1)

console/pom.xml:173

  • The spring-ai-starter-mcp-server-webmvc dependency is added but appears to be unused in the codebase. Consider removing this dependency or document its intended use if it's meant for future functionality. Adding unused dependencies increases the application's footprint and potential security surface area.
                        <configuration>
                            <nodeVersion>v19.5.0</nodeVersion>
                        </configuration>
                    </execution>
                    <execution>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@funky-eyes funky-eyes requested a review from Copilot December 18, 2025 05:58
@funky-eyes funky-eyes added this to the 2.6.0 milestone Dec 18, 2025
@funky-eyes funky-eyes added type: feature Category issues or prs related to feature request. module/console module/namingserver labels Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Xb2555 Xb2555 changed the title feature: upgrade the namingserver and console modules to JDK 25 and SpringBoot 3.5, and add the spring-ai module to the console module. feature: upgrade the namingserver and console modules to JDK 25 and SpringBoot 3.5, and add the spring-ai dependency to the console module. Dec 18, 2025
@funky-eyes funky-eyes requested a review from Copilot December 18, 2025 08:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

virtual:
enabled: true
mvc:
pathmatch:
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PathMatchingStrategy configuration using 'ant_path_matcher' forces Spring MVC to use the legacy AntPathMatcher instead of the newer PathPatternParser (default in Spring Boot 3.x). While this maintains backward compatibility with patterns like /**/*.css, be aware that PathPatternParser is more efficient. Consider migrating path patterns to be compatible with PathPatternParser in the future for better performance, or document why the legacy matcher is required.

Suggested change
pathmatch:
pathmatch:
# Use legacy AntPathMatcher for compatibility with existing patterns like /**/*.css, /**/*.js, etc.
# Switching to PathPatternParser (Spring Boot 3.x default) would require updating these patterns.

Copilot uses AI. Check for mistakes.
Comment on lines +138 to +139
// PathPatternParser using the new version of Security cannot directly achieve the same matching effect
// as the deprecated Ant style mode /**/*.css
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment explaining why AntPathRequestMatcher is used is helpful. However, the explanation could be clearer. The issue is that Spring Security 6.x uses PathPatternParser by default, which has stricter matching rules than the legacy Ant style matcher. Patterns like /**/*.css work differently between the two. Consider adding a reference or example to make this clearer for future maintainers.

Suggested change
// PathPatternParser using the new version of Security cannot directly achieve the same matching effect
// as the deprecated Ant style mode /**/*.css
// In Spring Security 6.x, requestMatchers(String...) uses PathPatternParser by default, which has
// stricter matching rules than the legacy Ant-style matcher. For example, the Ant pattern "/**/*.css"
// (often used for static resources) is not interpreted the same way by PathPatternParser and may no
// longer match all nested paths as expected. We therefore use AntPathRequestMatcher explicitly so
// that ignore / CSRF patterns coming from configuration keep their original Ant-style semantics.
// See: Spring Security Reference - "Request Matchers" section.

Copilot uses AI. Check for mistakes.
Comment on lines 113 to +139

// Create the HttpEntity with headers and body
HttpEntity<byte[]> httpEntity = new HttpEntity<>(request.getCachedBody(), headers);

// Forward the request
AsyncContext asyncContext = servletRequest.startAsync();
asyncContext.setTimeout(5000L);
ListenableFuture<ResponseEntity<byte[]>> responseEntityFuture = asyncRestTemplate.exchange(
URI.create(targetUrl),
Objects.requireNonNull(HttpMethod.resolve(request.getMethod())),
httpEntity,
byte[].class);
responseEntityFuture.addCallback(new ListenableFutureCallback<ResponseEntity<byte[]>>() {
@Override
public void onFailure(Throwable ex) {
try {
logger.error(ex.getMessage(), ex);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} finally {
asyncContext.complete();
HttpMethod httpMethod;
try {
httpMethod = HttpMethod.valueOf(request.getMethod());
} catch (IllegalArgumentException ex) {
logger.error("Unsupported HTTP method: {}", request.getMethod(), ex);
response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
return;
}
try {
ResponseEntity<byte[]> responseEntity = restTemplate.exchange(
URI.create(targetUrl), httpMethod, httpEntity, byte[].class);
responseEntity.getHeaders().forEach((key, value) -> {
value.forEach(v -> response.addHeader(key, v));
});
response.setStatus(
responseEntity.getStatusCode().value());
Optional.ofNullable(responseEntity.getBody()).ifPresent(body -> {
try (ServletOutputStream outputStream = response.getOutputStream()) {
outputStream.write(body);
outputStream.flush();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}

@Override
public void onSuccess(ResponseEntity<byte[]> responseEntity) {
// Copy response headers and status code
responseEntity.getHeaders().forEach((key, value) -> {
value.forEach(v -> response.addHeader(key, v));
});
response.setStatus(responseEntity.getStatusCodeValue());
// Write response body
Optional.ofNullable(responseEntity.getBody())
.ifPresent(body -> {
try (ServletOutputStream outputStream = response.getOutputStream()) {
outputStream.write(body);
outputStream.flush();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
asyncContext.complete();
}
});
});
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The significant refactoring of ConsoleRemotingFilter from AsyncRestTemplate to RestTemplate changes the core request forwarding mechanism. This change lacks test coverage to verify that the synchronous RestTemplate with virtual threads provides equivalent functionality to the previous asynchronous implementation. Consider adding tests to verify proper request forwarding, error handling, and timeout behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +22
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration from org.apache.httpcomponents:httpclient (HttpClient 4.x) to org.apache.httpcomponents.client5:httpclient5 (HttpClient 5.x) involves significant API changes. The imports have been correctly updated to use org.apache.hc.client5 packages. However, ensure that the HttpComponentsClientHttpRequestFactory from Spring is compatible with HttpClient 5.x at runtime, as Spring's HttpComponentsClientHttpRequestFactory may have different configuration methods for HttpClient 5.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes merged commit c13207c into apache:2.x Dec 18, 2025
11 checks passed
@Xb2555 Xb2555 deleted the jdk-update branch December 18, 2025 10:00
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
…pringBoot 3.5, and add the spring-ai dependency to the console module. (apache#7870)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/console module/namingserver type: feature Category issues or prs related to feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants