re: Singletons versus Dependency Injection VIEW POST


Interesting I have always used Spring for dependency injection so interesting seeing a 'vanilla' approach particularly for situations where such libraries aren't available to be used. Wouldn't the second Java example result in a NullPointerException when run as the constructor isn't called since the instance isn't initialised?

code of conduct - report abuse