语言组织得不好,莫见怪,
这个是spring.net srping.web.mvc3的一个bug,他的SpringControllerFactory里面的
protected override IController GetControllerInstance 这个方法写得有问题,改正的应该是
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
IController controllerInstance = null;
if (controllerType != null)
{
IDictionary objectsOfType = ApplicationContext.GetObjectsOfType(controllerType);
if (objectsOfType.Count > 0)
{
controllerInstance = (IController)objectsOfType.Cast<DictionaryEntry>().First<DictionaryEntry>().Value;
}
else
{
controllerInstance = base.GetControllerInstance(requestContext, controllerType);
}
}
else // there should be if (contollerInstance == null)
{
controllerInstance = base.GetControllerInstance(requestContext, controllerType);
}
this.AddActionInvokerTo(controllerInstance);
return controllerInstance;
}
本文讨论了Spring.NET中一个重要的bug,涉及到SpringControllerFactory的GetControllerInstance方法的修正,提供了修复代码以解决该问题。

被折叠的 条评论
为什么被折叠?



