[In preview] Public Preview: Announcing Tenant-Level Service Health Alerts in Azure Monitor
August 12, 2025MDVM Guidance for CVE-2025-53786: Exchange Hybrid Privilege Escalation
August 12, 2025The GitHub Copilot App Modernization – Upgrade for Java is an AI-powered solution designed to streamline the modernization of legacy Java applications. This tool is available as a Visual Studio Code extension and leverages GitHub Copilot to perform the following tasks:
- Analyze the project and its dependencies and propose an upgrade plan.
- Execute the plan to transform the project.
- Automatically fix issues during the progress.
- Report all details including commits, logs, and output.
- Perform a check for Common Vulnerabilities and Exposures (CVE) security vulnerabilities and code inconsistencies after the upgrade.
- Show a summary including file changes, updated dependencies, and fixed issues.
- Generate unit test cases separately from the upgrade process.
Prerequisites
To get started, ensure the following are installed:
- Visual Studio Code
- GitHub Copilot account
- GitHub Copilot chat extension for Visual Studio Code
- GitHub Copilot app modernization – upgrade for Java extension for Visual Studio Code
- Source and Target JDKs (Java Development Kit) – JDK 8 and JDK 21
- Node.js and npm (Node Package Manager) (required for building frontend app)
Project Setup
After installing all prerequisites, clone the following repository:
git clone https://github.com/yortch/spring-petclinic-angularjs
Open the project in Visual Studio Code and confirm that you can build and run the application using the instructions from the README file:
./mvnw clean install
cd spring-petclinic-server
../mvnw spring-boot:run
Navigate to the application and verify the Pet Clinic loads at: http://localhost:8080/
GitHub Copilot App Modernization – Upgrade for Java tools
The extension includes several built-in tools to assist with upgrading Java projects. You can list these tools by asking GitHub Copilot chat in VS Code: “What tools are available in the GitHub Copilot Upgrade for Java?”. You’ll see output similar to the following:
Typical Upgrade Workflow
- Plan Generation → generate_upgrade_plan_for_java_project
- Plan Review → confirm_upgrade_plan_for_java_project
- Automated Changes → upgrade_java_project_using_openrewrite
- Build Validation → build_java_project
- Test Execution → run_tests_for_java
- Behavior Validation → validate_behavior_changes_for_java
- Security Check → validate_cves_for_java
- Documentation → summarize_upgrade
- Framework/Library Upgrades
- Spring Boot: 2.7.x, 3.2.x, 3.3.x, 3.4.x, 3.5.x
- Jakarta EE: 10.0.x (from Java EE)
- Spring Framework: 6.1.x, 6.2.x
- Custom Dependencies: Any Maven/Gradle dependency
Additionally, the tool generate_tests_for_java can be used independently to increase test coverage before upgrading, helping validate that there no breaking changes are introduced.
The upgrade_java_project_using_openrewrite tool uses OpenRewrite, an open-source project with Java upgrade-specific recipes. At the time of writing, version 1.1.0 of the upgrade plugin is used.
Java Project Upgrade
To begin the upgrade, use the generate_upgrade_plan_for_java_project tool. Ensure all file changes are committed or discarded beforehand to avoid warnings.
Using Agent mode with Claude Sonnet 4 as the model in GitHub Copilot, provide a prompt similar to the following, replacing the JDK paths from your local setup:
#generate_upgrade_plan_for_java_project for spring-petclinic-server project
into Java 21 and latest SpringBoot 3.x available using
jdk 8 location: C:Usersjbalderasappsjdk8u442-b06 and
jdk21 location: C:Program FilesEclipse Adoptiumjdk-21.0.2.13-hotspot
After a few minutes, a preview of the upgrade plan will be displayed. Review and update the plan as needed. If it meets your expectations, click Continue:
As the upgrade proceeds, you’ll see each step completed with logs available from build output, unit test results, as well as any failures. The extension will iterate through build and test errors, resolving them incrementally. Occasionally, you may need to click Continue if the tool loops through a task multiple times.
Once complete, a summary screen will show all changes and the upgrade status:
During our upgrade, we noticed that the Maven wrapper (mvnw) was not automatically updated. This caused build failures due to version incompatibility (this was undetected during the upgrade because maven was used directly). To resolve this, ask GitHub Copilot:
Upgrade maven wrapper to at least version 3.6.3
This updates the distributionUrl in the maven-wrapper.properties file. Click Keep to accept the changes.
Then, rerun the build and launch commands:
./mvnw clean install
cd spring-petclinic-server
../mvnw spring-boot:run
Visit http://localhost:8080 to confirm the Pet Clinic loads successfully.
All changes should be committed to a branch named java-upgrade-. If there are any remaining changes, commit and push them, then create a pull request.
Here’s an example of a draft pull request showing 27 changed files across 6 commits, completed in just minutes:
We hope this walkthrough demonstrates how the GitHub Copilot App Modernization – Upgrade for Java can save time and eliminate the tedious work of upgrading legacy code. Give it a try and share your feedback below!