Take the 2-minute tour ×

I come across a strange issue, where my spring controller is being called twice for a single request but when turn my firefox into private browsing the issue disappears

The controller is:

public class UserController {

@RequestMapping(method=RequestMethod.GET, value="home")
public String home(Model model, NativeWebRequest request, HttpSession session) {

    return "user/homepage";


note: I have verified user/homePage.jsp and it does not have any static resource referring empty value (and also the issue occurs only on non-private browsing).

Thanks in advance for timely help

share|improve this question

1 Answer 1

up vote 0 down vote accepted

One thing you could check is if your application context that scans for controller components is being loaded twice. For example say in your web xml you configured the dispatcher servlet to be named dispatcher in your web.xml and you configured the contextConfigLocation to load the following bean config files.


This could results in the controller getting hit twice per request becuase the dispatcher-servlet is automatically loaded once when the dispatcher servlet starts up and another time when the ContextLoaderListener starts up.

share|improve this answer
Thanks for the quick response: here is my web.xml : –  Gopal haris Dec 18 '12 at 19:26
Thanks for the quick response: I guess the web.xml looks fine, plz point me if require any change: <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-config.xml</param-value> </context-param> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-clas‌​s> <load-on-startup>1</load-on-startup> </servlet> but how come the issue is resolved when I have the browser in private browsing ? and I don;t use any cookies as well –  Gopal haris Dec 18 '12 at 19:33
Hey Thanks, <load-on-startup>1</load-on-startup> setting the load-on-startup to 0 resolved the issue but still don't understand why is in private browsing the issue does not occur –  Gopal haris Dec 19 '12 at 9:19

Your Answer


