语言组织得不好,莫见怪,
这个是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;
}