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 8941313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:16:17+00:00 2026-06-15T11:16:17+00:00

Possible Duplicate: What is Inversion of Control? I’m really confused with the concept of

  • 0

Possible Duplicate:
What is Inversion of Control?

I’m really confused with the concept of dependency injection.

I’m very new to software field and I have a doubt on the following scenario. Let say I need a Json parser class for my java code, So I’m adding the Json jar when executing the java program using the classpath argument. My program is dependent on Json jar, so that it mean I’m doing a dependency injection here?

An another example will be, using import statement does solve the problem of user class is depending on other class ( like Date in java ) so all these are the concept of dependency injection?

Where I’m making the concept.

Thanks in advance.

  • 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-06-15T11:16:19+00:00Added an answer on June 15, 2026 at 11:16 am

    It’s much more to do with how you link your components together. e.g. in the above, I would expect you to inject your parser into the class that needs it. e.g.

    Instead of:

    public class MyParserUsingClass {
       ...
       public MyParserUsingClass() {
          this.parser = new Parser();
       }
    }
    

    you would do:

    public class MyParserUsingClass {
       ...
       public MyParserUsingClass(Parser injectedParser) {
          this.parser = injectedParser;
       }
    }
    

    Why do this ? Your class using the parser doesn’t really care where the parser comes from and should really use an interface rather than a concrete instance. By injecting the parser, you can supply different instances depending on circumstances, mock it out for testing etc. Otherwise the class would just create it internally and you’d have no control over it. This is particularly key for configurable components, components that talk across the network, heavyweight components etc.

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

Sidebar

Related Questions

Possible Duplicate: Inversion of Control < Dependency Injection Could anyone please help me to
Possible Duplicate: What is Inversion of Control? Okay, I'm new to this site and
Possible Duplicates: Difference between Dependency Injection (DI) & Inversion of Control (IOC) Inversion of
Possible Duplicate: What is Inversion of Control? I am not familiar with Inversion of
Possible Duplicate: What is Inversion of Control? I always hear Inversion of Control described
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Python : how to append new elements in a list of list?
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: Opening url in new tab while i am doing window.open(), my page
Possible Duplicate: regex for URL including query string I have a text or message.

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.