Spring 3.1 WebApplicationInitializer & Embedded Jetty 8 AnnotationConfiguration

后端 未结 13 1104
無奈伤痛
無奈伤痛 2020-12-13 14:16

I\'m trying to create a simple webapp without any XML configuration using Spring 3.1 and an embedded Jetty 8 server.

However, I\'m struggling to get Jetty to recogni

13条回答
  •  感情败类
    2020-12-13 14:37

    To those experiencing this lately, it appears this gets around the issue:

    @Component
    public class Initializer implements WebApplicationInitializer {
    
        private ServletContext servletContext;
    
        @Autowired
        public WebInitializer(ServletContext servletContext) {
            this.servletContext = servletContext;
        }
    
        @PostConstruct
        public void onStartup() throws ServletException {
            onStartup(servletContext);
        }
    
        public void onStartup(ServletContext servletContext) throws ServletException {
            System.out.println("onStartup");
        }
    }
    

提交回复
热议问题