ensure that refactored DependencyResolver code properly respects named contexts when performing object resolution

This commit is contained in:
Steve Bohlen
2015-02-02 20:15:42 -05:00
parent c7f943e0c4
commit c75734dfad

View File

@@ -97,17 +97,17 @@ namespace Spring.Web.Mvc
}
// fastest lookup is if we have direct name match
if (_context.ContainsObjectDefinition(serviceType.Name))
if (ApplicationContext.ContainsObjectDefinition(serviceType.Name))
{
service = _context.GetObject(serviceType.Name);
service = ApplicationContext.GetObject(serviceType.Name);
}
else
{
// fall back to more expensive searching with type
var matchingServices = _context.GetObjectNamesForType(serviceType);
var matchingServices = ApplicationContext.GetObjectNamesForType(serviceType);
if (matchingServices.Count > 0)
{
service = _context.GetObject(matchingServices[0]);
service = ApplicationContext.GetObject(matchingServices[0]);
}
}