David Rogers
04/13/2023, 12:20 PMDavid Rogers
04/13/2023, 12:22 PMapplication.wirebox.getInstance() = {
result = <ortus stuff>;
return result;
}
to
application.wirebox.getInstance() = {
if (<http://arguments.xyz|arguments.xyz> == "something") {
result = <our stuff>
otherResult = <call actual getInstance>
return <do stuff with both>;
}
else {
return <call actual getInstance>
}
}
sknowlton
04/13/2023, 12:57 PMDavid Rogers
04/13/2023, 1:04 PMgetInstance() = {
if (isAotConstructible(binding)) { return pool.getOrCreate(binding); }
else { return defaultGetInstance(...); }
}
sknowlton
04/13/2023, 1:04 PMDavid Rogers
04/13/2023, 1:06 PMbdw429s
04/13/2023, 2:04 PMbdw429s
04/13/2023, 2:04 PMbdw429s
04/13/2023, 2:05 PMbdw429s
04/13/2023, 2:06 PMbdw429s
04/13/2023, 2:08 PMthey take zero arguments to construct, and constructing them has no dependencies on time of day or whatever☝️ This also describes basically every CFC ever which has no constructor args defined. There's nothing specical about that, it's just a CFC like any other.
bdw429s
04/13/2023, 2:09 PMcoldbox:xx
and logbox:xxx
are examples of this. You can register a foobar:
scope which defers to your own custom builder so whether someone asks for foobar:brad
or foobar:sam
your custom factory can decide what gets built.bdw429s
04/13/2023, 2:11 PMbdw429s
04/13/2023, 2:14 PMDavid Rogers
04/13/2023, 2:55 PMLinkedBlockingDeque<Future<cfc>>
, and I can pull from it, and repopulate it from time to time.bdw429s
04/13/2023, 2:57 PMDavid Rogers
04/13/2023, 2:57 PMDavid Rogers
04/13/2023, 2:57 PMbdw429s
04/13/2023, 2:58 PMbdw429s
04/13/2023, 3:00 PMDavid Rogers
04/13/2023, 3:00 PMgetInstance("foo")
I want foo to "silently" pull from the queuebdw429s
04/13/2023, 3:00 PMbdw429s
04/13/2023, 3:00 PMI want foo to "silently" pull from the queueYes, exactly. And I'm telling you to use a custom scope to do so, lol
bdw429s
04/13/2023, 3:01 PMcomponent scope="pooled" {}
bdw429s
04/13/2023, 3:01 PMbdw429s
04/13/2023, 3:01 PMDavid Rogers
04/13/2023, 3:02 PMmap("foo").into("pooled")
or thereabouts. Wasn't sure if I could control 3rd party dependencies that way? Like I know some module is binded as "X" by default, I'd also like "X" to participate in thisbdw429s
04/13/2023, 3:02 PMbdw429s
04/13/2023, 3:03 PMDavid Rogers
04/13/2023, 3:03 PMbdw429s
04/13/2023, 3:03 PMbdw429s
04/13/2023, 3:04 PMbdw429s
04/13/2023, 3:04 PMbdw429s
04/13/2023, 3:05 PMDavid Rogers
04/13/2023, 3:06 PMbdw429s
04/13/2023, 3:06 PMmap("Luis").toDSL("someAlreadyExistingModel@RandomModule").into( "pooled" )
David Rogers
04/13/2023, 3:07 PMbdw429s
04/13/2023, 3:07 PMgetInstance( 'luis' )
or
property name="thing" inject="luis";
and as part of bulding that mapping, it delegates to the other mappingDavid Rogers
04/13/2023, 3:08 PMbdw429s
04/13/2023, 3:09 PMDavid Rogers
04/13/2023, 3:09 PMbdw429s
04/13/2023, 3:10 PMbdw429s
04/13/2023, 3:10 PMgetinstance( 'com.path.to.component' )
creates a mapping, but not until the instant it's asked for the first timebdw429s
04/13/2023, 3:11 PMbdw429s
04/13/2023, 3:11 PMbeforeInstanceCreation
may be of use if you can modify the mapping on the fly before it's builtsknowlton
04/13/2023, 3:12 PMbdw429s
04/13/2023, 3:13 PMDavid Rogers
04/13/2023, 3:14 PMbdw429s
04/13/2023, 3:16 PMafterInstanceInspection
which says this
Called after an object mapping has been completely processed with its DI metadata discovery. This is your last chance to change or modify the DI data in the mapping before it is cached.
bdw429s
04/13/2023, 3:17 PMbdw429s
04/13/2023, 3:18 PMbdw429s
04/13/2023, 3:20 PMDavid Rogers
04/13/2023, 3:21 PMbdw429s
04/13/2023, 3:23 PMbdw429s
04/13/2023, 3:23 PMDavid Rogers
04/13/2023, 3:24 PMbdw429s
04/13/2023, 3:24 PMbdw429s
04/13/2023, 3:25 PMbdw429s
04/13/2023, 3:26 PM