title: how to configure 'dispatcherServlet' load on startup by spring boot?
body: <p>I use <code>spring-boot-starter-parent</code> as parent and add <code>spring-boot-starter-web</code> as denpendency.</p>
  
  <p>By add the <code>@SpringBootApplication</code> annotation, it works.</p>
  
  <p>But <code>DispatcherServlet</code> need initialization</p>
  
  <pre><code>     Initializing servlet 'dispatcherServlet'
       FrameworkServlet 'dispatcherServlet': initialization started
       Using MultipartResolver [org.springframework.web.multipart.support.StandardServletMultipartResolver@745f40ac]
       Unable to locate LocaleResolver with name 'localeResolver': using default [org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver@219fc57d]
       Unable to locate ThemeResolver with name 'themeResolver': using default [org.springframework.web.servlet.theme.FixedThemeResolver@7b4bd6bd]
       Unable to locate RequestToViewNameTranslator with name 'viewNameTranslator': using default [org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator@71ccfa36]
       Unable to locate FlashMapManager with name 'flashMapManager': using default [org.springframework.web.servlet.support.SessionFlashMapManager@43f3e6a9]
       Published WebApplicationContext of servlet 'dispatcherServlet' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcherServlet]
       FrameworkServlet 'dispatcherServlet': initialization completed in 37 ms
  </code></pre>
  
  <hr>
  
  <p>I hope I can set it's loadonstartup by 1, and don't want to use this 
  annoying <code>BeanNameUrlHandlerMapping</code>, it rejected everything and I'm not going to use it.</p>
  
  <pre><code>o.s.w.s.h.BeanNameUrlHandlerMapping      : Rejected bean name 'contextAttributes': no URL paths identified
  </code></pre>
  
  <p>I read the java-doc about <code>BeanNameUrlHandlerMapping</code>:</p>
  
  <blockquote>
    <p>This is the default implementation used by the org.springframework.web.servlet.DispatcherServlet, along with org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping (on Java 5 and higher). Alternatively, SimpleUrlHandlerMapping allows for customizing a handler mapping declaratively.</p>
  </blockquote>
  
  <p>That's all, I just want to change these two thing:</p>
  
  <ol>
  <li>setLoadonStartup</li>
  <li>don't use BeanNameUrlHandlerMapping</li>
  </ol>
  
  <p>Beside that, other thing spring boot configure for me is very great, and I want to keep it.</p>
  
  <p>Thank you for any help you can provide.</p>