I studied the Spring State Machine and the State design pattern , since I have to develop a microservice with Spring loading and stored objects with a lot of confusing states that need to be cleaned up, and I'm looking for a clean design solution from this mess. I checked DDD, state concepts and State Machine, seeing which ones to apply
I am not sure how to implement some concepts and how to connect them. I would like to understand if:
- Can Spring State Machine work with objects during transitions or only at the state level of a global application?
- To manage multiple entities each in its own state, must it be created as a component with a prototype?
- Is it easy to integrate with the State pattern or should it not be used together?
- To manage this, I have to enter state or state machines in Entities (maybe I know, but I don't like the idea using @Configurable and the appropriate AspectJ weaving configuration )? I share the impression of someone that can make it more complex, and maybe I will have to use
@Scope("prototype") - Instead, if it is possible for Domain Services to delegate State Machines to an entity (such as another domain service) for individual objects to change state? Or is it an anemic domain antipattern , but if so, how well does the State Machine integrate with DDD?
- Is there any example of how the Spring State Machine will let me do what I want to do, how light it is, and how slow and memory consuming it will be?
:
- DDD , , , , DDD
- , Context
-
- , , , , ( , , )
- -
Context State. , -? / State Entity Proxy?
, , .
,