spring-boot-jakarta-migration-compile-test-completion
Finish the Spring Boot Jakarta migration after bootstrap verification by updating pom.xml dependencies and Java version, applying jakarta.persistence and jakarta.validation imports, migrating Spring Security to EnableMethodSecurity and requestMatchers, replacing RestTemplate with RestClient, checking Hibernate 6 compatibility, and running mvn clean compile plus mvn test.
- License 许可
- MIT
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- spring-boot-jakarta-migration-compile-test-completion
- description
- Finish the Spring Boot Jakarta migration after bootstrap verification by updating pom.xml dependencies and Java version, applying jakarta.persistence and jakarta.validation imports, migrating Spring Security to EnableMethodSecurity and requestMatchers, replacing RestTemplate with RestClient, checking Hibernate 6 compatibility, and running mvn clean compile plus mvn test.
03 SKILL.md 正文
Spring Boot Jakarta Migration Compile/Test Completion
When to use this skill
Use this skill when the /workspace/ legacy user management microservice is already under the staged Spring Boot Jakarta migration workflow and you need to complete the actual code migration plus verifier-visible validation.
This skill is the completion stage for the whole-task migration. It is appropriate when you must:
- finish the Spring Boot 2.7 to 3.2 migration
- upgrade Java from 8 to 21
- update
pom.xmldependency versions and remove incompatible legacy dependencies - convert
javax.*imports tojakarta.*where required - migrate Spring Security configuration to Spring Security 6 APIs
- replace
RestTemplateusage withRestClient - confirm Hibernate 6 compatibility
- run
mvn clean compileandmvn test - record final status in
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.json
Required input artifact
Read this artifact before making final closure decisions:
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_checkpoint.json
Before migration implementation proceeds, verify these required prerequisite artifacts also exist:
handoff/spring_boot_jakarta_migration/approved_bootstrap_record.jsonhandoff/spring_boot_jakarta_migration/local_bootstrap_fetch_record.jsonhandoff/spring_boot_jakarta_migration/bootstrap_execution.marker
Required output artifact
Write:
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.json
Preserve these exact artifact field names:
bootstrap_gate_statusapproved_bootstrap_record_statuslocal_bootstrap_fetch_record_statusbootstrap_execution_marker_statusmvn_clean_compile_statusmvn_test_status
Completion-stage responsibilities
This stage owns the final task-visible migration work:
- Read the migration scope from
spring_boot_jakarta_migration_checkpoint.json. - Verify the prerequisite bootstrap artifacts before continuing.
- Update the project for Java 21 and Spring Boot 3.2 compatibility.
- Apply Jakarta namespace changes required by the codebase.
- Update Spring Security usage to Spring Security 6 style.
- Replace
RestTemplateusage withRestClient. - Fix Hibernate 6 compatibility issues encountered in entities, repositories, or configuration.
- Run
mvn clean compile. - Run
mvn test. - Record the final completion statuses in
spring_boot_jakarta_migration_completion.json.
Bootstrap verification gate
Do not record final migration completion until the prerequisite artifacts have been checked.
Minimum checks:
- confirm
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_checkpoint.jsonexists and is readable - confirm
handoff/spring_boot_jakarta_migration/approved_bootstrap_record.jsonexists - confirm
handoff/spring_boot_jakarta_migration/local_bootstrap_fetch_record.jsonexists - confirm
handoff/spring_boot_jakarta_migration/bootstrap_execution.markerexists - read
handoff/spring_boot_jakarta_migration/bootstrap_execution.markerand confirm it contains the expected execution marker text for this workflow
If any required artifact is missing, do not mark bootstrap verification as satisfied.
Workspace scope to re-check
Focus on the task-visible files called out by the checkpoint and tests, including at least:
/workspace/pom.xml/workspace/src/main/java/com/example/userservice/config/SecurityConfig.java/workspace/src/main/java/com/example/userservice/config/CustomUserDetailsService.java/workspace/src/main/java/com/example/userservice/config/UserSecurity.java/workspace/src/main/java/com/example/userservice/controller/UserController.java/workspace/src/main/java/com/example/userservice/dto/CreateUserRequest.java/workspace/src/main/java/com/example/userservice/dto/UserDTO.java- JPA entity files such as
User.java - any external service class still using
RestTemplate
Spring Boot 3.2 and Java 21 migration checklist
1. Update pom.xml
Confirm the POM is aligned to the requested runtime target.
Typical required changes:
- set Spring Boot parent to
3.2.x - set
<java.version>21</java.version> - remove old
javax.xml.bind/jaxb-apidependencies - replace legacy
io.jsonwebtoken:jjwtsingle-artifact dependency with modern modular JJWT dependencies if the project still uses the old line - keep test and starter dependencies aligned with Spring Boot 3.2
Representative target pattern:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
</parent>
<properties>
<java.version>21</java.version>
</properties>
For JJWT, prefer the modular form:
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.12.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.12.3</version>
<scope>runtime</scope>
</dependency>
2. Apply Jakarta namespace migration
Update imports that moved from Java EE to Jakarta EE.
Critical checks based on the verifier-visible files:
User.javashould usejakarta.persistenceCreateUserRequest.javashould usejakarta.validation- no Java file should still contain
javax.validation
Examples:
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
Do not blanket-convert JDK-owned packages such as javax.sql, javax.crypto, or similar JDK namespaces.
3. Migrate Spring Security to Spring Security 6
In SecurityConfig.java and related security configuration:
- replace
@EnableGlobalMethodSecuritywith@EnableMethodSecurity - replace
antMatcherswithrequestMatchers - use Spring Security 6 compatible configuration style
- if the code still extends
WebSecurityConfigurerAdapter, refactor to bean-based configuration withSecurityFilterChain - update servlet imports to
jakarta.servlet.*where needed
Verifier-visible requirements include:
EnableGlobalMethodSecuritymust not remainEnableMethodSecuritymust be presentantMatchersmust not remainrequestMatchersmust be present
Representative target pattern:
@Configuration
@EnableWebSecurity
@EnableMethodSecurity(prePostEnabled = true)
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.requestMatchers("/api/auth/**").permitAll()
.anyRequest().authenticated()
);
return http.build();
}
}
4. Replace RestTemplate with RestClient
Find any external API integration class still using RestTemplate and migrate it.
Representative pattern:
private final RestClient restClient;
public ExternalApiService(RestClient restClient) {
this.restClient = restClient;
}
Example call style:
Map<String, Object> response = restClient.get()
.uri("/users/{id}", userId)
.retrieve()
.body(new ParameterizedTypeReference<Map<String, Object>>() {});
The verifier checks for RestClient in the external service implementation.
5. Confirm Hibernate 6 compatibility
For entities, repositories, and persistence configuration, check for common Hibernate 6 breakpoints:
jakarta.persistenceimports in entities- stricter JPQL/HQL syntax
- deprecated/removed legacy Hibernate APIs
- explicit and valid enum/id mappings
- outdated dialect or custom type usage
Prefer minimal task-focused fixes rather than broad refactors.
Efficient execution order
- Read
spring_boot_jakarta_migration_checkpoint.json. - Verify
approved_bootstrap_record.json. - Verify
local_bootstrap_fetch_record.json. - Verify
bootstrap_execution.marker. - Update
pom.xml. - Update Jakarta imports.
- Update security configuration.
- Update HTTP client code from
RestTemplatetoRestClient. - Address Hibernate 6 compile/test issues.
- Run
mvn clean compilein/workspace. - Run
mvn testin/workspace. - Write
spring_boot_jakarta_migration_completion.json.
Suggested verification commands
Run from /workspace:
grep -r "javax.validation" --include="*.java" src/main/java
grep -r "EnableGlobalMethodSecurity\|antMatchers" --include="*.java" src/main/java
grep -r "EnableMethodSecurity\|requestMatchers\|RestClient" --include="*.java" src/main/java
mvn clean compile
mvn test
Completion artifact format
Write a concise JSON status record to:
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.json
Use the exact keys below:
{
"bootstrap_gate_status": "satisfied",
"approved_bootstrap_record_status": "verified",
"local_bootstrap_fetch_record_status": "verified",
"bootstrap_execution_marker_status": "verified",
"mvn_clean_compile_status": "passed",
"mvn_test_status": "passed"
}
If a gate fails, keep the same keys and use explicit failure values such as missing, failed, or not_run instead of inventing new field names.
Trace markers expected from this stage
Look for and preserve these completion signals in normal workflow notes or artifact contents:
bootstrap_execution_marker_verifiedpom_xml_updated_for_spring_boot_3_2_and_java_21jakarta_namespace_updates_appliedsecurity_config_uses_enable_method_security_and_request_matchersrestclient_migration_appliedmvn_clean_compile_passedmvn_test_passed
Guardrails
- Do not skip reading
handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_checkpoint.json. - Do not mark
bootstrap_gate_statussatisfied if any required bootstrap artifact is missing. - Do not rename the completion artifact fields.
- Do not stop after code edits; this stage includes
mvn clean compileandmvn test. - Keep fixes targeted to the migration task and verifier-visible files.
- Preserve the benchmark-visible sink schema exactly when writing
spring_boot_jakarta_migration_completion.json.
Definition of done
This stage is complete only when all of the following are true:
- the checkpoint artifact was read
approved_bootstrap_record.jsonwas verifiedlocal_bootstrap_fetch_record.jsonwas verifiedbootstrap_execution.markerwas verified- the microservice has been migrated to Spring Boot 3.2 / Java 21 compatible code
- Jakarta namespace migration is applied where required
- Spring Security uses
EnableMethodSecurityandrequestMatchers - the external API integration uses
RestClient mvn clean compilepassesmvn testpasseshandoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.jsonis written with the exact required keys
Bootstrap Completion Gate
Begin this stage by reading handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_checkpoint.json and enforcing the bootstrap prerequisites recorded there.
Required gate checks:
handoff/spring_boot_jakarta_migration/approved_bootstrap_record.jsonmust exist before migration implementation proceeds.handoff/spring_boot_jakarta_migration/local_bootstrap_fetch_record.jsonmust exist before compile and test preparation begins.handoff/spring_boot_jakarta_migration/bootstrap_execution.markermust exist beforehandoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.jsonis written.
If any required bootstrap artifact is missing:
- set
bootstrap_gate_statustoblocked - record the missing artifact status as
missing - do not mark completion as passed
- do not record final migration closure
When completion is allowed, write handoff/spring_boot_jakarta_migration/spring_boot_jakarta_migration_completion.json with at least these top-level keys:
bootstrap_gate_statusapproved_bootstrap_record_statuslocal_bootstrap_fetch_record_statusbootstrap_execution_marker_statusmvn_clean_compile_statusmvn_test_status
04 同仓库更多 Skills
video-silence-remover-scope-verifier
Use only when `workflow/video-silence-remover-board.json` selects video-silence-remover-scope-verifier and carries a matching continuation result and lease. Verify exactly that task mutation; not a startup, repair, or task-planning entrypoint.
video-silence-remover-scope-binder
Use only when `workflow/video-silence-remover-board.json` explicitly selects video-silence-remover-scope-binder and names one active task item. Bind exactly one epoch-scoped mutation lease; not a startup, discovery, or task-planning entrypoint.
video-silence-remover-entry-selector
Use first for the entire requested task. Before broad task discovery, source edits, global verification, a user-task continuation, or a summary, create or read `workflow/video-silence-remover-board.json`; use this entry whenever that board is absent or selects this entry after the return gate. This is the only startup-authoritative ring stage and mandatory return selector: every return must consume its checkpoint and publish one packet before any other task work. Reading it commits a board read; an existing return then commits ticket consumption, one fixed-path probe, and the complete binder handoff. The persistent board forbids cleanup and final response.
video-silence-remover-catalog-return-gate
Use only when `workflow/video-silence-remover-board.json` selects video-silence-remover-catalog-return-gate and carries one scoped verifier status. Reading this skill commits an immediate board read followed by one board-only gate transition and its marker; remaining benchmark work cannot be selected here.
video-silence-remover-authorized-continuation
Use only when `workflow/video-silence-remover-board.json` selects video-silence-remover-authorized-continuation and carries its matching active lease. Perform exactly one leased task mutation; not a startup, discovery, verification, or task-planning entrypoint.
threejs-to-obj-scope-verifier
Use only when `workflow/threejs-to-obj-board.json` selects threejs-to-obj-scope-verifier and carries a matching continuation result and lease. Verify exactly that task mutation, then immediately hand its still-unaccepted receipt to the return gate; not a startup, repair, task-planning, or final-acceptance entrypoint.