java - Lazy Instantiation of the Spring MVC DispatcherServlet? -


is there way me instantiate spring mvc dispatcherservlet in code rather put in web.xml , have instantiated web server?

the reason want check memcache see if have rendered page being requested , if return memcache, rather going through spring mvc , controllers.

the ~2 second instantiation of dispatcherservlet significant because using google app engine , might end being additional 2 seconds user has wait page.

i have tried

dispatcherservlet = new dispatcherservlet(); dispatcherservlet.init(); dispatcherservlet.service(request, response); 

but exception on init call:

[java] java.lang.nullpointerexception [java]         @ org.springframework.web.servlet.httpservletbean$servletconfigpropertyvalues.<init>(httpservletbean.java:196) [java]         @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:114) 

basically, i'm looking way instantiate servlet in code without having specify in web.xml , not have call

getservletconfig().getservletcontext().getservlet("dispatcherservlet"); 

dispatcherservlet servlet, should call init(servletconfig) instead of init() initialize it.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -