Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:41:32+00:00 2026-05-27T12:41:32+00:00

I have been going through the tutorials of Spring 3 at http://www.vaannila.com/spring/spring-annotation-controller-1.html But i

  • 0

I have been going through the tutorials of Spring 3 at
http://www.vaannila.com/spring/spring-annotation-controller-1.html

But i have one doubt regarding autowired feature of spring3.

If you look at sample code given at the site, it has used @Autowired before setUserService method.
Now i have several question about it.

  1. Is this the standard of using autowire ?? that is create a interface, implement its method and then finally in your controller class use the interface class’s setter method.

  2. if i use autowire in that way what is the benefit i got ?

  3. what is the substitute code of using autowire ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:41:32+00:00Added an answer on May 27, 2026 at 12:41 pm

    .1. Is this the standard of using autowire ?? that is create a interface, implement its method and then finally in your controller class use the interface class’s setter method.

    Yes, this is more-or-less standard way, but this is just a convention. Some consider this to be a bad practice. It is not enforced in any way by Spring (however you might be forced to add CGLIB to your dependencies if you don’t use interfaces).

    .2. if i use autowire in that way what is the benefit i got ?

    Don’t know what do you mean by that way, but just to name few benefits: easier testing, decoupling, less infrastructure code…

    .3. what is the substitute code of using autowire ?

    Again, hard to tell what do you mean by substitute code. There are plenty of other techniques: you can use XML, @Configuration, @Resource, @Inject, (probably few other ats), constructor injection, field injection, setter injection (the one in the tutorial), looking up Spring beans directly from BeanFactory…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to databases and have been going through various tutorials, but they all
I've been going through the tutorial at hginit.com, but I've found a rather inconvenient
I'm new to python and have been going through some tutorials on log parsing
I've searched on this, but nothing has what I'm looking for. http://www.mail-archive.com/pygtk@daa.com.au/msg10529.html -- Nobody
I have been going through documentation and such and have SVN working, but I
I have been going through the core jQuery code and had a few why
Recently, I have been going through search trees and I encountered red-black trees, the
I have been tasked with going through a number of ColdFusion sites that have
I am starting asp.net MVC2 by going through a few tutorials, but they are
I am going through the android hello world tutorial, and have been stuck when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.