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

  • SEARCH
  • Home
  • 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 6843129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:12:31+00:00 2026-05-27T00:12:31+00:00

I wanted to understand how exactly the @Autowired annotation works. import com.test.WorkFlowDAO; public class

  • 0

I wanted to understand how exactly the @Autowired annotation works.

import com.test.WorkFlowDAO;

public class ServiceCentralBOImpl implements IServiceCentralBO
{
    /**
     * Logger for logging functionality.
     */
    private static final Log log = LogFactory.getLog(ServiceCentralBOImpl.class);

    @Autowired
    private WorkFlowDAO workFlowDAO;
    .
    .
    .
}

and the bean is declared in my Spring applicationContext.xml file:

<bean id="workflowDAO" class="com.test.WorkFlowDAO">
</bean>

Upon closer inspection you can see the two IDs in the Java class and the context XML file are different.

workFlowDAO and

workflowDAO

[The letter ‘f’ is different in the two IDs]

Since my application runs just fine even with this configuration; I wanted to know,
how does @Autowired annotation work so that it does not complain when the bean IDs do not match exactly.

In case of simple bean usage; Spring would have complained of mismatching bean names.

I am running a J2EE application with Spring 3.0.5 on Websphere App Server 7.0

Let me know if any more information is required.

  • 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-27T00:12:31+00:00Added an answer on May 27, 2026 at 12:12 am

    @Autowired matches the beans by type. The ID is not considered.

    If you declare another bean of the same type in your XML configuration, Spring would complain about not being able to determine the correct bean.

    If you want to use IDs together with @Autowired you can do so by utilizing @Qualifier although @Resource is recommended in this case.

    Find some more info on that topic here.

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

Sidebar

Related Questions

I wanted to understand on when exactly I need to declare a variable as
I wanted to understand how indexing in MySql works. I've few questions regarding indexing.
Wanted to understand the difference between undef and define a macro as 0. Thanks.
I wanted to understand how we can implement a safe logout method in a
I'm taking over a project and wanted to understand if this is common practice
I was looking at the first table on http://zero.milosz.ca/ , and wanted to understand
I'm quite new to this (understanding the WP Guts), and I wanted to understand
just wanted to ask where I define initial class properties? From other languages I
I don't exactly understand how ASP.NETs ActionLinks work. I see that they have a
I'm working on a crawler and need to understand exactly what is meant by

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.