Struts application can be Migrated to Springboot application using the watsonx Code Assistant (WCA).
This feature needs to be GAed by Q2.
WCA does the following steps to convert the Struts to Springboot application.
- Analyze Java code for modernization opportunities
- Generate migration recommendations
- Transform code between different Java frameworks and specifications
- Preserve business logic while updating implementation patterns
- Convert build configurations between different build systems
The sample struts code, the converted springboot code and the logs are given for few sample applications.
Application | Struts Code | Converted springboot code | Logs | Fix Instruction |
---|---|---|---|---|
Sample App | Link | Link | Link | Link |
Auto Insurance | Link | Link | Link | |
Banking | Link | Link | Link |
- Clone the repository:
git clone https://github.ibm.com/watsonx-apac/wca-springboot.git
cd wca-springboot
- Install dependencies:
pip install -r requirements.txt
- Set up your IBM Cloud API key in
.env
file:
IAM_APIKEY=your_api_key_here
- Execute the below command.
python wca_springboot.py migrate-structs ./path/to/struts/app --output ./custom/output/path
Here are the code changes done by this tool.
As a first step, it creates Spring Boot project structure
You can view the entire Spring Boot code here.
The CustomerAction from Struts is converted into CustomerController
The converted springboot controller is accessed through RESTful endpoints instead of a method
parameter.
The CustomerService from Struts is converted into service layer CustomerService
The Struts Form/DTO is converted into Spring Boot DTO equivalent.
The CustomerForm from Struts is converted into springboot Customer
The CustomerDTO from Struts is converted into springboot CustomerDTO
The JSP pages are migrated to Thymeleaf.
pom.xml file is migrated.