mercredi 30 novembre 2016

Spring State Machine Builder/Configuration Design Pattern with Large Number of Transitions

For example the Spring State Machine is configured like so: source

.source("S1")
.target("S2")
.event("E1")
.action(timerAction());

This will lead to hundreds of lines of configuration. Leaving a messy configuration class for the state machine. I was thinking to make this cleaner to wrap each of these into a method/bean themselves as a transition, and add transitions to the state machine.

statemachinebuilder.addTransition(transitionBean);

I wanted to hear if others had any better suggestions? It could be externalized but then this would just be defining the same transition objects and reading them into construct the state machine. Thanks.

Aucun commentaire:

Enregistrer un commentaire