core-java
core-java copied to clipboard
One `Model` per bounded context
Currently, Model
is a system-wide singleton. The problem with this is revealed when trying to add more complex validation, e.g. find the correspondence between commands and bounded contexts.
In order to make Model
agiler, and also prohibit inadequate access to the Model
instances, we should turn it into a per-BC concept.
The suggested approach is to produce strict rules on what a bounded context is at compile time.
This can be done by introducing module annotation @BoundedContext
and consider this module to contain the definition of the bounded context.