Class DemoServletConfiguration


@Configuration public class DemoServletConfiguration extends Object
This class manually registers those Servlets that require Autowired services and components. In a "normal" Spring Boot environment you would just add the ServletComponentScan-Annotation and add the @WebServlet-Annotation to the servlet and everything is fine. In a traditional deployment (WAR on App-Server) the App-Server registers the servlet, and it doesn't care about the ServletComponentScan. So what we do is removing the @WebServlet-Annotation and register the servlets with a ServletRegistrationBean.
  • Constructor Details

    • DemoServletConfiguration

      public DemoServletConfiguration()
  • Method Details

    • uploadServletRegistrationBean

      @Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<DocumentUploadServlet> uploadServletRegistrationBean()