• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interface injection in Spring

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am new to Spring.

Can anyone of you please explain Interface Injection in Spring with a simple example?

Or is there any tutorial available for this?

I searched, but unable to find for interface injection in particular.

Have a great weekend !

Thanks
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A simple example:


And now you just need a reference of the SomeRepository interface which will be injected (by type, since SomeRepositoryImpl implements SomeRepository) via setter method:
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring doesn't support Interface injection and the above example about autowiring is incorrect.
Will reply more later.
 
Manikandan Swaminathan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kengkaj,

Can you please post the details?

If possible please mail me the details. My mail id is graghuu@gmail.com

Thanks for your help !

Regards
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring does not fully support Interface injection although the same can be achieved using "autowire=byType". But this has some serious drawbacks. See this discussion for a proposed implementation of Interace injection in Spring:
http://opensource.atlassian.com/confluence/spring/display/DISC/Adding+Interface+Injection+to+Spring
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic