Let's get rid of static field based singletons
hurelhuyag opened this issue · 2 comments
There is static field based singletons at template files. Those singletons making hard to write tests. In my view, We should get rid of those static fields. Generally it's bad design choice.
I have found some of those:
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/JournalProvider.ftl#L26
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/ProjectionDispatcherProvider.ftl#L22
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/StateStoreProvider.ftl#L34
Event this. I don't see any particular reason to declare static field here.
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/DefaultBootstrap.ftl#L20
See also this section of code where the Bootstrap must now pass constructor parameters rather than the components being started relying on static objects: