This project demonstrates a context-based migration strategy using the Strangler Fig Pattern in Java with Gradle.
Instead of replacing the entire legacy codebase at once, this approach wraps existing code with a context-aware facade and incrementally routes new functionality into separate, isolated action classes.
- Context-aware class routing
- Legacy functionality remains untouched
- New functionality implemented as
Actionclasses ContextFactorydynamically provides the correct implementation
src/java/
│
├── MyClass.java → Legacy Entry Point
├── MyClassContext.java → Context Interface for Routing
├── MyClassContextFactory.java → Factory for Context Decision
│
├── Action/
│ ├── Method1Action.java → New Implementation of Method1
│ └── Method2Action.java → New Implementation of Method2
│
├── Value.java / ValueMap.java → Supporting Data Objects
└── Main.java → Application Entry Point
// Example inside MyClass.java
MyClassContext context = MyClassContextFactory.create(valueMap);
context.method1();
context.method2();- Old logic stays in
MyClass - New logic grows in
Actionclasses - Context Factory decides dynamically which implementation to use
./gradlew build./gradlew run./gradlew test- Minimal risk during migration
- Legacy & New Code co-exist
- Easy to test new features independently
- Clean separation of concerns
- Scalable migration strategy
Apache License, Version 2.0 [https://www.apache.org/licenses/LICENSE-2.0.txt]
Matthis Burger — [info@burger-it.de]