Printf(“%s %s”, dependency, injection)
If you don&#x27;t like frameworks, just inject dependencies manually. It&#x27;s very simple, it scales to hundreds of classes and then you can migrate to DI (but probably you won&#x27;t reach that line ever, microservices are here to stay).<p><pre><code>    class Service1 { ... }
    class Service2 {
        private Service2 service2;
        void setService2(...)
        void afterPropertiesSet() { requireNonNull(service2, &quot;service2&quot;); }
    }
        main() {
            Service1 service1 = new Service1();
            Service1 service2 = new Service2();
            ...
            service2.setService1(service1);
            ...
            service1.afterPropertiesSet();
            service2.afterPropertiesSet();
            ...
</code></pre>
I used setter injection and afterPropertiesSet callback. It allows not to worry about construction order and loops. Also it allows to fail fast if dependency not set. And it&#x27;s compatible with Spring, if you ever decide to use it. But using constructor injection is even simpler and for applications with few dozens of services that might be a more clean approach.