It's a bit complicated, but it works if you need a dependency inside the interface for any requirements.
The idea would be to declare a method that forces the implemented class to provide this dependency that you want to auto-increment.
The bad side of this approach is that if you want to provide too many dependencies, the code will not be very nice, since you will need one getter for each dependency.
public interface TestWiring { public Service getService(); default void testWiringMethod(){ getService().testService(); } } public class TestClass implements TestWiring { @Autowire private Service service; @Override public Service getService() { return service; } }
ibai
source share