JaroslavTulach: /* Double Injection */ - 2015-03-22 05:50:50

Double Injection

←Older revision Revision as of 05:50, 22 March 2015
Line 38: Line 38:
* [http://hudson.apidesign.org/hudson/job/lookup/javadoc/ javadoc]
* [http://hudson.apidesign.org/hudson/job/lookup/javadoc/ javadoc]
-
* [http://hudson.apidesign.org/hudson/job/lookup/lastSuccessfulBuild/artifact/org.apidesign/anagram-spring-lookup/ library JAR]
+
* [http://hudson.apidesign.org/hudson/job/lookup/lastSuccessfulBuild/artifact/spring.lookup/target/ library JAR]
* [http://source.apidesign.org/hg/lookup/file/tip/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.
* [http://source.apidesign.org/hg/lookup/file/tip/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.

JaroslavTulach at 19:12, 7 June 2012 - 2012-06-07 19:12:29

←Older revision Revision as of 19:12, 7 June 2012
Line 37: Line 37:
I am not sure if this kind of ''double'' [[injection]] can be useful in web applications where developer is also acting as assembler putting everything together, but in [[Use Modular Architecture|modular applications]] it has its place. If you are interested, see and use the [[Spring]]/[[Lookup]] bridge:
I am not sure if this kind of ''double'' [[injection]] can be useful in web applications where developer is also acting as assembler putting everything together, but in [[Use Modular Architecture|modular applications]] it has its place. If you are interested, see and use the [[Spring]]/[[Lookup]] bridge:
-
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
+
* [http://hudson.apidesign.org/hudson/job/lookup/javadoc/ javadoc]
-
* [http://hudson.apidesign.org/hudson/view/lookup/job/lookup/org.apidesign$spring-lookup/ library JAR]
+
* [http://hudson.apidesign.org/hudson/job/lookup/lastSuccessfulBuild/artifact/org.apidesign/anagram-spring-lookup/ library JAR]
-
* [http://source.apidesign.org/hg/lookup/file/4e7bfa1677e2/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.
+
* [http://source.apidesign.org/hg/lookup/file/tip/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.
Leave here comments about your satisfaction, disappointment and my confusion.
Leave here comments about your satisfaction, disappointment and my confusion.
<comments/>
<comments/>

JaroslavTulach: /* Double Injection */ - 2010-02-08 13:54:15

Double Injection

←Older revision Revision as of 13:54, 8 February 2010
Line 21: Line 21:
=== Double [[Injection]] ===
=== Double [[Injection]] ===
-
Yet, if there are extensions written according to the [[ServiceLoader|Java Extension]] mechanism or using the ''@ServiceProvider'' annotation offered by the [[Lookup]] library, one can have [[JAR]] files one with:
+
Yet, if there are extensions written according to the [[ServiceLoader|Java Extension]] mechanism or using the ''@ServiceProvider'' annotation offered by the [[Lookup]] library, one can have a [[JAR]] file containing result of compilation of:
<source lang="java" snippet="anagramdemo.springlookup.scrambler"/>
<source lang="java" snippet="anagramdemo.springlookup.scrambler"/>

JaroslavTulach: /* Double Injection */ - 2010-02-05 21:40:19

Double Injection

←Older revision Revision as of 21:40, 5 February 2010
Line 38: Line 38:
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
 +
* [http://hudson.apidesign.org/hudson/view/lookup/job/lookup/org.apidesign$spring-lookup/ library JAR]
* [http://source.apidesign.org/hg/lookup/file/4e7bfa1677e2/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.
* [http://source.apidesign.org/hg/lookup/file/4e7bfa1677e2/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.

89.176.101.42: /* Double Injection */ - 2010-01-14 21:30:34

Double Injection

←Older revision Revision as of 21:30, 14 January 2010
Line 38: Line 38:
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
 +
* [http://source.apidesign.org/hg/lookup/file/4e7bfa1677e2/spring.lookup source] - use ''hg clone http://source.apidesign.org/hg/lookup/'' to get it localy.
Leave here comments about your satisfaction, disappointment and my confusion.
Leave here comments about your satisfaction, disappointment and my confusion.
<comments/>
<comments/>

JaroslavTulach at 06:52, 25 November 2009 - 2009-11-25 06:52:43

←Older revision Revision as of 06:52, 25 November 2009
Line 1: Line 1:
-
An important subset of [[Spring]] is said to be an example of [[Dependency Injection]]. [[Lookup]] library, originally invented by [[NetBeans]] project seems to do similar kind of [[injection]]. Do these two [[API]]s server similar purpose or are they both quite different? Each of them is optimized for slightly different task. Could they strengthen themselves if they worked together? That it what we'll find soon out.
+
An important subset of [[Spring]] is said to be an example of [[Dependency Injection]]. [[Lookup]] library, originally invented by [[NetBeans]] project seems to do similar kind of [[injection]]. Do these two [[API]]s serve similar purpose or are they both quite different? Each of them is optimized for slightly different task. Could they strengthen themselves if they worked together? That it what we'll find soon out.
Imagine there is a GUI application to play the [[wikipedia::Anagrams|Anagrams Game]]. We have a base UI class called ''Anagrams'' that needs two additional interfaces to be injected. In [[Spring]] world, this can be done with a two arguments constructor:
Imagine there is a GUI application to play the [[wikipedia::Anagrams|Anagrams Game]]. We have a base UI class called ''Anagrams'' that needs two additional interfaces to be injected. In [[Spring]] world, this can be done with a two arguments constructor:

JaroslavTulach at 06:52, 25 November 2009 - 2009-11-25 06:52:21

←Older revision Revision as of 06:52, 25 November 2009
Line 1: Line 1:
-
An important subset of [[Spring]] is said to be an example of [[Dependency Injection]]. [[Lookup]] library, originally invented by [[NetBeans]] project used to be said to do similar kind of [[injection]]. From a distance they seem to server similar purpose, yet after closer look they are both different. Each of them is optimized for slightly different task. Could they strengthen themselves if they worked together? That it what we'll find soon out.
+
An important subset of [[Spring]] is said to be an example of [[Dependency Injection]]. [[Lookup]] library, originally invented by [[NetBeans]] project seems to do similar kind of [[injection]]. Do these two [[API]]s server similar purpose or are they both quite different? Each of them is optimized for slightly different task. Could they strengthen themselves if they worked together? That it what we'll find soon out.
Imagine there is a GUI application to play the [[wikipedia::Anagrams|Anagrams Game]]. We have a base UI class called ''Anagrams'' that needs two additional interfaces to be injected. In [[Spring]] world, this can be done with a two arguments constructor:
Imagine there is a GUI application to play the [[wikipedia::Anagrams|Anagrams Game]]. We have a base UI class called ''Anagrams'' that needs two additional interfaces to be injected. In [[Spring]] world, this can be done with a two arguments constructor:

JaroslavTulach: /* Java Extension Mechanism */ - 2009-04-28 09:50:34

Java Extension Mechanism

←Older revision Revision as of 09:50, 28 April 2009
Line 13: Line 13:
=== Java Extension Mechanism ===
=== Java Extension Mechanism ===
-
To open door and allow others to do late binding [[injection|inject]] various implementations of ''WordLibrary'' and ''Scrambler'' classes and be discovered using [[ServiceLoader|Java Extension Mechanism]] as abstracted by [[Lookup]]. Just compose your own XML context with the [[ServiceLoader|Java Extension]] one in your main method:
+
To open door and allow others to do late [[injection]] to bind various implementations of ''WordLibrary'' and ''Scrambler'' classes, one can use the [[LookupAndSpring]] bridge. Then the actual implementations of needed interfaces are to be discovered using [[ServiceLoader|Java Extension Mechanism]] as abstracted by [[Lookup]]. The steps are simple. Get the [[LookupAndSpring]] and [[Lookup]] libraries and just compose your own XML context with the [[ServiceLoader|Java Extension]] one in your main method:
<source lang="java" snippet="anagramdemo.springlookup.main"/>
<source lang="java" snippet="anagramdemo.springlookup.main"/>
-
This creates an unfinished, open application to be extended by other [[JAR]]s composed together by those who assemble and deploy the final application. Yet, the coding style and testing of individual application's [[JavaBean]]s can be done using the classical [[Spring]] [[Dependency Injection]] style of development (just like the ''Anagrams'' class shows).
+
This creates an unfinished, open application to be extended by other [[JAR]]s orchestrated together by those who assemble and deploy the final application. Yet, the coding style and testing of individual application's [[JavaBean]]s can be done using the classical [[Spring]] [[Dependency Injection]] style of development (just like the ''Anagrams'' class shows).
=== Double [[Injection]] ===
=== Double [[Injection]] ===

84.35.81.2: /* Java Extension Mechanism */ - 2009-04-28 06:18:51

Java Extension Mechanism

←Older revision Revision as of 06:18, 28 April 2009
Line 13: Line 13:
=== Java Extension Mechanism ===
=== Java Extension Mechanism ===
-
To open door and allow others to do late bindng [[injection|inject]] various implementations of ''WordLibrary'' and ''Scrambler'' classes and be discovered using [[ServiceLoader|Java Extension Mechanism]] as abstracted by [[Lookup]]. Just compose your own XML context with the [[ServiceLoader|Java Extension]] one in your main method:
+
To open door and allow others to do late binding [[injection|inject]] various implementations of ''WordLibrary'' and ''Scrambler'' classes and be discovered using [[ServiceLoader|Java Extension Mechanism]] as abstracted by [[Lookup]]. Just compose your own XML context with the [[ServiceLoader|Java Extension]] one in your main method:
<source lang="java" snippet="anagramdemo.springlookup.main"/>
<source lang="java" snippet="anagramdemo.springlookup.main"/>

JaroslavTulach: /* Double Injection */ - 2009-04-28 04:40:48

Double Injection

←Older revision Revision as of 04:40, 28 April 2009
Line 21: Line 21:
=== Double [[Injection]] ===
=== Double [[Injection]] ===
-
Yet, if there are extensions written according to the [[ServiceLoader|Java Extension]] mechanism or using the ''@ServiceProvider'' annotation offered by the [[Lookup]] library, one can have two [[JAR]] files with:
+
Yet, if there are extensions written according to the [[ServiceLoader|Java Extension]] mechanism or using the ''@ServiceProvider'' annotation offered by the [[Lookup]] library, one can have [[JAR]] files one with:
<source lang="java" snippet="anagramdemo.springlookup.scrambler"/>
<source lang="java" snippet="anagramdemo.springlookup.scrambler"/>
-
and another one with:
+
and another one with another class:
<source lang="java" snippet="anagramdemo.springlookup.wordlibrary"/>
<source lang="java" snippet="anagramdemo.springlookup.wordlibrary"/>
-
and it composition together becomes piece of cake. Instead of writing complicated binding [[XML]] file or doing inefficient on start scan of all resources in a package, one can just put all three [[JAR]] files into classpath and they look each other up effectively and unrestrainably.
+
or even more [[JAR]]s with different implementations of the same interfaces.
-
In some sense this represent an example of double [[injection]]. First of all we instructed the [[Spring]] framework to do its [[Dependency Injection]] to provide necessary implementations to the ''Anagrams'' class constructor. Yet, these implementations are unknown at compile time of the [[JAR]] and they are not present in any single configuration file. Instead they are picked up from the runtime classpath by using ''Java Extension Mechanism'' as abstracted by [[Lookup]]''.getDefault()''. This is the second level of [[injection]] where the assembler injects various [[JAR]]s into effective application classpath.
+
The composition of final application then becomes piece of cake. Instead of writing complicated binding [[XML]] file or doing inefficient on start scan of all resources in a package, one can just put selected [[JAR]] files into classpath and they look each other up effectively and unrestrainably.
-
I am not sure if this kind of ''double'' [[injection]] can be useful in web applications where developer is also kind of assembler putting everything together, but in [[Use Modular Architecture|modular applications]] it has its place. If you are interested, see and use the [[Spring]]/[[Lookup]] bridge:
+
In some sense this represent an example of double [[injection]]. First of all we instructed the [[Spring]] framework to do its [[Dependency Injection]] to provide necessary implementations to the ''Anagrams'' class constructor. Yet, these implementations are unknown at compile time of the [[JAR]] and they are not present in any single configuration file. Instead they are picked up from the runtime classpath by using [[ServiceLoader|Java Extension Mechanism]] as abstracted by [[Lookup]]''.getDefault()''. This is the second level of [[injection]] where the assembler injects various [[JAR]]s into effective application classpath.
 +
 
 +
I am not sure if this kind of ''double'' [[injection]] can be useful in web applications where developer is also acting as assembler putting everything together, but in [[Use Modular Architecture|modular applications]] it has its place. If you are interested, see and use the [[Spring]]/[[Lookup]] bridge:
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]
* [http://hudson.apidesign.org/hudson/job/lookup/org.apidesign$spring-lookup/javadoc/ javadoc]