Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38722

Re: How to make my library independent using DI

X-Received by 2002:ad4:4310:: with SMTP id c16mr6121574qvs.47.1548857599761; Wed, 30 Jan 2019 06:13:19 -0800 (PST)
X-Received by 2002:a81:450:: with SMTP id 77mr132752ywe.6.1548857599531; Wed, 30 Jan 2019 06:13:19 -0800 (PST)
Path csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!v55no1450127qtk.0!news-out.google.com!m21ni682qta.0!nntp.google.com!v55no1450120qtk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Wed, 30 Jan 2019 06:13:19 -0800 (PST)
In-Reply-To <slrnq52u2s.k8o.avl@logic.at>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=192.176.1.80; posting-account=1c_fOgoAAADuOXlL0A4-T9PUmVHtMSYd
NNTP-Posting-Host 192.176.1.80
References <c9bc00ee-744c-49e2-b026-08a68841cf48@googlegroups.com> <slrnq52u2s.k8o.avl@logic.at>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <e09b44b3-55fd-4dc9-a16c-156e1bd4fff8@googlegroups.com> (permalink)
Subject Re: How to make my library independent using DI
From mike <mikaelpetterson@hotmail.com>
Injection-Date Wed, 30 Jan 2019 14:13:19 +0000
Content-Type text/plain; charset="UTF-8"
Lines 27
Xref csiph.com comp.lang.java.programmer:38722

Show key headers only | View raw


Hi Andreas,

Thanks for your comments. I really appreciate them.

> Not sure what you mean by inject, but according to your code snippet,
> there is no "hard dependency" to AHelper in your lib.

I will definitely check for null.

I think I need to do a litte bit more explanation.

I need to create an instance of AHelper, in the application using the library,and inject it into my lib. Otherwise I will not be able to access the data from
 version() and productNumber().

I mean shall I call:

MyDataClassImpl( new AHelper()) from the application? And at what point in time should this be done.
And if the MyDataClassImpl needs more external data, let's say from BHelper() also, do add the following in my app:

MyDataClassImpl(new AHelper(),new BHelper()) ?


Thanks for helping out!!

//mikael


Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to make my library independent using DI mike <mikaelpetterson@hotmail.com> - 2019-01-29 10:11 -0800
  Re: How to make my library independent using DI Martin Gregorie <martin@mydomain.invalid> - 2019-01-29 19:29 +0000
  Re: How to make my library independent using DI Andreas Leitgeb <avl@logic.at> - 2019-01-30 10:11 +0000
    Re: How to make my library independent using DI mike <mikaelpetterson@hotmail.com> - 2019-01-30 06:13 -0800
      Re: How to make my library independent using DI Andreas Leitgeb <avl@logic.at> - 2019-02-01 14:13 +0000
  Re: How to make my library independent using DI Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-02-04 16:33 +0100

csiph-web