diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs index e11ec5be..0fb30445 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs @@ -836,7 +836,7 @@ namespace Spring.Objects.Factory.Support if (factory.IsSingleton && ContainsSingleton(canonicalName)) { - lock (factoryObjectProductCache) + lock (factoryObjectProductCache.SyncRoot) { resultInstance = factoryObjectProductCache[canonicalName]; if (resultInstance == null) @@ -844,14 +844,15 @@ namespace Spring.Objects.Factory.Support resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod); if (resultInstance != null) { - factoryObjectProductCache.Add(canonicalName, resultInstance); + factoryObjectProductCache[canonicalName] = resultInstance; } - return resultInstance; } } } - - resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod); + else + { + resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod); + } if (resultInstance == null) { diff --git a/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs b/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs index abcfd016..d04e224f 100644 --- a/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs +++ b/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs @@ -58,7 +58,7 @@ namespace Spring.Objects.Factory.Xml objectName = webObjectNameGenerator.CreatePageDefinitionName(url); } - // adjust aliases if necessary + // strip leading homepath symbol ('~') from aliases if necessary for (int ai = 0; ai < aliases.Count; ai++) { string alias = (string)aliases[ai]; @@ -70,9 +70,14 @@ namespace Spring.Objects.Factory.Xml } else if (strTypeName.EndsWith(".ascx") || strTypeName.EndsWith(".master")) { + string controlName = webObjectNameGenerator.CreateControlDefinitionName(url); if (!StringUtils.HasText(objectName)) { - objectName = webObjectNameGenerator.CreateControlDefinitionName(url); + objectName = controlName; + } + else + { + aliases.Add(controlName); } }