Back to Lab Insights

Migrating from Struts to Spring: A Case Study

SiliconAgent Team
December 30, 2025
4 min read

Struts to Spring Migration Architecture

Background

A Fortune 500 financial services company approached us with a common challenge: their core trading platform was built on Apache Struts 1.x, a framework that had reached end-of-life years ago. The system processed millions of transactions daily and couldn't afford significant downtime.

The Challenge

The legacy system presented several critical issues:

Technical Debt

  • 15+ years of code accumulation – Over 2 million lines of code
  • Outdated dependencies – Many libraries with known vulnerabilities
  • Monolithic architecture – Difficult to scale and maintain
  • Poor test coverage – Only 15% code coverage

Business Constraints

  • Zero tolerance for downtime – System processes $10B+ daily
  • Regulatory compliance – Strict audit requirements
  • Limited resources – Small team maintaining legacy system
  • Tight timeline – Board mandate to modernize within 18 months

Our Approach

Phase 1: Assessment and Planning

We began with a comprehensive analysis of the existing system:

Assessment Results:
├── Total Files: 8,547
├── Lines of Code: 2,143,892
├── Struts Actions: 1,247
├── JSP Pages: 892
├── Database Tables: 456
├── External Integrations: 34
└── Critical Business Rules: 2,891

Key findings from the assessment:

  1. Core business logic was well-isolated – Good foundation for migration
  2. Heavy use of Struts-specific features – Required careful mapping to Spring
  3. Session management complexity – Needed architectural changes
  4. Inconsistent error handling – Opportunity for improvement

Phase 2: Architecture Design

We designed a target architecture that would:

  • Preserve existing business logic
  • Enable incremental migration
  • Support modern cloud deployment
  • Improve maintainability

The target stack:

  • Spring Boot 3.x – Modern application framework
  • Spring MVC – Request handling
  • Spring Data JPA – Data access
  • Spring Security – Authentication and authorization
  • React – Modern frontend (optional migration)

Phase 3: Automated Migration

Using SiliconAgent Transform, we automated the bulk of the migration:

Controller Migration

Struts Actions were automatically converted to Spring Controllers:

// Before: Struts Action
public class UserAction extends Action {
    public ActionForward execute(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) {

        UserForm userForm = (UserForm) form;
        UserService service = new UserService();
        List<User> users = service.getUsers(userForm.getFilter());
        request.setAttribute("users", users);
        return mapping.findForward("success");
    }
}

// After: Spring Controller
@Controller
@RequestMapping("/users")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping
    public String getUsers(
            @ModelAttribute UserForm form,
            Model model) {

        List<User> users = userService.getUsers(form.getFilter());
        model.addAttribute("users", users);
        return "users/list";
    }
}

Configuration Migration

Struts XML configurations were converted to Spring annotations:

<!-- Before: struts-config.xml -->
<action path="/user/list"
        type="com.example.UserAction"
        name="userForm"
        scope="request"
        validate="true">
    <forward name="success" path="/WEB-INF/jsp/users/list.jsp"/>
    <forward name="error" path="/WEB-INF/jsp/error.jsp"/>
</action>
// After: Spring configuration via annotations
@Controller
@RequestMapping("/user")
public class UserController {

    @GetMapping("/list")
    public String list(Model model) {
        return "users/list";
    }

    @ExceptionHandler(Exception.class)
    public String handleError() {
        return "error";
    }
}

Phase 4: Validation and Testing

We generated comprehensive tests to ensure functional equivalence:

  • 4,500+ unit tests generated automatically
  • Integration tests for all API endpoints
  • Performance benchmarks comparing old vs new
  • Security scans validating no new vulnerabilities

Results

The migration was completed in 14 months, exceeding expectations:

MetricBeforeAfterImprovement
Response Time450ms120ms73% faster
Memory Usage8GB3GB62% reduction
Deployment Time45 min5 min89% faster
Test Coverage15%92%77% increase
Security Vulnerabilities470100% resolved

Business Impact

  • $2.3M annual savings in infrastructure costs
  • 50% reduction in maintenance effort
  • 3x faster time-to-market for new features
  • Zero downtime during migration

Lessons Learned

What Worked Well

  1. Incremental approach – Migrating module by module reduced risk
  2. Automated testing – High confidence in each migration step
  3. Parallel running – Validated behavior before cutover
  4. Strong stakeholder communication – Regular updates maintained trust

Challenges Faced

  1. Session management differences – Required careful architectural decisions
  2. JSP migration complexity – Some pages needed manual intervention
  3. Third-party integrations – Varying levels of Spring compatibility
  4. Team training – Upskilling developers on Spring ecosystem

Conclusion

Migrating from Struts to Spring is a significant undertaking, but with the right approach and tools, it can be accomplished successfully while maintaining business continuity. The key is combining automated transformation with careful planning and thorough testing.

Want to learn how SiliconAgent Transform can help your Struts migration? Contact us for a personalized assessment.

Share this article: