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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:18:37+00:00 2026-05-25T19:18:37+00:00

I’m writing a Java component that will be doig pretty heavy-duty work on some

  • 0

I’m writing a Java component that will be doig pretty heavy-duty work on some big data. Obviously, therefore, efficiency (both speed and memory) is paramount.

I’m also just starting to work with IoC and dependency injection frameworks for the first time (such Spring AOP, Google Guice, etc.), and was wondering if they could help me out at all.

What I’d like to do is something like this (all throughout my code):

List<MyData> oMyData = new List<MyData>();

Then, in some XML config file (or however the framework configures injections), I would specify that every time an instance of List is created, to inject, say, an ArrayList<MyData> as its implementation.

This way, if, down the road, I decide to use a different implementation, or even something homegrown that suits my application more efficiently than anything provided by Java Collections, I only need to change the class that gets injected. No other modifications would be necessary, and my code will run that much more efficiently.

Is this is a possible solution, or is this just big dreaming? Again, because I’m so new to IoC frameworks it’s tough to tell what objects injections will work on, whether generics can be preserved during injection, and all sorts of other complicating details I can’t seem to find answers to anywhere else.

Thanks in advance for any insight or recommendations!

  • 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-25T19:18:37+00:00Added an answer on May 25, 2026 at 7:18 pm

    This does not sound like a classic scenario for an IOC container, but you could use a factory method.

    public static List<MyData> createDataList(){
        return new ArrayList<MyData>();
    }
    

    Use this factory method all over your app. Now if you want to use a different list implementation, just change this method. Look mom, no container needed.

    Just to be clear: IOC is an awesome concept. But I don’t think what you are talking about is a classic scenario for IOC.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I

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.