Asp.net MVC spring bootstrapper
I am trying to create a bootstrapper with the tasks (currently RegisterRoutes and RegisterControllerFactory) defined in a Spring.Net container. Bootstrap code below:
public static void Run()
{
IApplicationContext applicationContext = WebApplicationContext.GetRootContext();
IDictionary bootstrapperTasks = applicationContext.GetObjectsOfType(typeof(IBootstrapperTask));
foreach (IBootstrapperTask bootstrapperTask in bootstrapperTasks.Values)
bootstrapperTask.Execute();
}
The problem is that if I want to start the bootstrapper in the Application_Start method, then the WebApplicationContext is not yet available - the earliest stage available is the Init method.
But since I know the Init method is not a good place to register routes (read at: http://aspnet.codeplex.com/WorkItem/View.aspx?WorkItemId=3325 )
Is there any workaround or do I need to create a boot file (without spring)?
thanks
a source to share
Since I have not used spring IOC with MVC (using Ninject) this may not help, but you can try
IApplicationContext ctx = ContextRegistry.GetContext();
and register bootstrapper objects in web.config file
http://www.springframework.net/doc-latest/reference/html/objects.html#objects-factory-instantiation
a source to share