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

Newsgroups comp.lang.java.programmer
Date 2019-01-30 06:13 -0800
References <c9bc00ee-744c-49e2-b026-08a68841cf48@googlegroups.com> <slrnq52u2s.k8o.avl@logic.at>
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>

Show all headers | 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