org.springframework.boot.context.web

Class SpringBootServletInitializer

  • java.lang.Object
    • org.springframework.boot.context.web.SpringBootServletInitializer
  • All Implemented Interfaces:
    org.springframework.web.WebApplicationInitializer


    public abstract class SpringBootServletInitializer
    extends Object
    implements org.springframework.web.WebApplicationInitializer
    A handy opinionated WebApplicationInitializer for applications that starts a Spring Boot application and lets it bind to the servlet and filter mappings. If your application is more complicated consider using one of the other WebApplicationInitializers.

    Note that a WebApplicationInitializer is only needed if you are building a war file and deploying it. If you prefer to run an embedded container (we do) then you won't need this at all.

    Author:
    Dave Syer
    • Field Detail

      • logger

        protected final org.apache.commons.logging.Log logger
    • Constructor Detail

      • SpringBootServletInitializer

        public SpringBootServletInitializer()
    • Method Detail

      • onStartup

        public void onStartup(javax.servlet.ServletContext servletContext)
                       throws javax.servlet.ServletException
        Specified by:
        onStartup in interface org.springframework.web.WebApplicationInitializer
        Throws:
        javax.servlet.ServletException
      • createRootApplicationContext

        protected org.springframework.web.context.WebApplicationContext createRootApplicationContext(javax.servlet.ServletContext servletContext)
      • configure

        protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
        Configure the application. Normally all you would need to do it add sources (e.g. config classes) because other settings have sensible defaults. You might choose (for instance) to add default command line arguments, or set an active Spring profile.
        Parameters:
        application - a builder for the application context
        See Also:
        SpringApplicationBuilder

Copyright © 2014 Pivotal Software, Inc.. All rights reserved.