Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion framework/ioc.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ component {
path = cfcPath, cfc = dottedPath, metadata = cleanMetadata( dottedPath ),
overrides = overrides
};
if ( metadata.metadata.inlineType == "singleton" ) {
metadata.isSingleton = true;
}
else if ( metadata.metadata.inlineType == "transient" ) {
metadata.isSingleton = false;
}
variables.beanInfo[ beanName ] = metadata;
return this;
}
Expand Down Expand Up @@ -383,7 +389,7 @@ component {

private struct function cleanMetadata( string cfc ) {
var baseMetadata = metadata( cfc );
var iocMeta = { setters = { }, pruned = false, type = baseMetadata.type };
var iocMeta = { setters = { }, pruned = false, type = baseMetadata.type, inlineType = "" }; // inlineType is populated if singleton / transient annotation declared
var md = { extends = baseMetadata };
do {
md = md.extends;
Expand All @@ -396,6 +402,12 @@ component {
if ( structKeyExists( md, 'accessors' ) && isBoolean( md.accessors ) ) {
implicitSetters = implicitSetters || md.accessors;
}
if ( structKeyExists( md, 'singleton' ) ) {
iocMeta.inlineType = "singleton";
}
else if ( structKeyExists( md, 'transient' ) ) {
iocMeta.inlineType = "transient";
}
if ( structKeyExists( md, 'properties' ) ) {
// due to a bug in ACF9.0.1, we cannot use var property in md.properties,
// instead we must use an explicit loop index... ugh!
Expand Down Expand Up @@ -559,6 +571,12 @@ component {
name = beanName, qualifier = singleDir, isSingleton = !beanIsTransient( singleDir, dir, beanName ),
path = cfcPath, cfc = dottedPath, metadata = cleanMetadata( dottedPath )
};
if ( metadata.metadata.inlineType == "singleton" ) {
metadata.isSingleton = true;
}
else if ( metadata.metadata.inlineType == "transient" ) {
metadata.isSingleton = false;
}
if ( structKeyExists( metadata.metadata, "type" ) && metadata.metadata.type == "interface" ) {
continue;
}
Expand Down