So, here’s a list of some possible options:
* Spring (Obviously the most adopted option, but also possibly quite fat)
* Quarkus (Jakarta EE)
* Weld (Just the CDI dependency injection)
* Micronaut
* Guice (Every time I’ve heard it, people were migrating away from it)
https://avaje.io/inject/ sounded interesting, as it seems to use the same
JSR-330 API as Spring and Quarkus use (I think) but doesn’t do dependency
injection at runtime but generates code that does the weaving. With this it
should be possible to see what’s happening. However, I’ve never tried it before.
Chris
Von: Christofer Dutz <[email protected]>
Datum: Dienstag, 9. Januar 2024 um 10:18
An: [email protected] <[email protected]>
Betreff: [DISCUSS] Switch from Singletons to using a component-framework?
Hi all,
So, I am currently fighting with something in IoTDB. It’s the usage of static
variables all over the place.
The problem I’m having, is that I’m working on building an App that allows to
run IoTDB in various forms of deployment. So, depending on the type of
deployment, you can switch the location of where data is stored.
So, in my case I’ve started IoTDB, and it stores data in a directory “data-1” …
so if I want to change this to “data-2” I need to stop IoTDB data-node and
config-node, change the configuration and start config-node and data-node again.
However, we are using singletons everywhere … the problem now is that these
don’t get re-initialized and they keep on pointing to “data-1”. Right now, I’m
preparing a PR, where I can manually trigger a re-initialization of these
singletons, by adding a static “reinitializeStatics()” method to them. But
that’s just a super-ugly hack.
The much better solution would be to not need statics, but to either manually
weave the components together or to use a component framework to do the weaving.
The benefit would also definitely be, that we could start running tests without
forking processes and we could probably even re-use VMs over tests.
What do you folks think?
Chris