Spring interface injection example

According to Variants of DI in spring

DI exists in two major variants, Constructor-based dependency injection and Setter-based dependency injection.

Also see Interface injection is not implemented in Spring clearly states it.

So there are only two variants of DI. So if documentation says nothing about interface injection, its clear that its not there. Those who believe that interface injection is done by providing setter method in interface answer me:

  1. Why spring ref doc left mention of interface injection?
  2. Why can’t interface injection via providing setter method NOT considered as setter injection itself. Why create special term for that when introduction of interface doesn’t affect anything, I mean its still configured the same way. If they were different then how can one find it via seeing the config. Shouldn’t it be transparent that in config and not seeing the impl that actually configured class implements some interface ?
  3. Just like Instantiation using an instance factory method and Instantiation using an static factory method, some bean attributes should clarify the interface injection?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)