I use spring-boot-starter-parent
as parent and add spring-boot-starter-web
as denpendency.
By add the @SpringBootApplication
annotation, it works.
But DispatcherServlet
need initialization
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
I hope I can set it's loadonstartup by 1, and don't want to use this
annoying BeanNameUrlHandlerMapping
, it rejected everything and I'm not going to use it.
o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'contextAttributes': no URL paths identified
I read the java-doc about BeanNameUrlHandlerMapping
:
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.
That's all, I just want to change these two thing:
Beside that, other thing spring boot configure for me is very great, and I want to keep it.
Thank you for any help you can provide.
New reply to old post. Seems this is easier to do with more recent versions of Spring Boot. Just adding the property spring.mvc.servlet.load-on-startup=1
works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With