Spring Boot does not honor @WebServlet

前端 未结 3 1267
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 12:38

I created a Servlet (extending from HttpServlet) and annotated as per 3.0 specs with

@WebServlet(name=\"DelegateServiceExporter\", urlPatterns={\"/remoting/Deleg         


        
3条回答
  •  一整个雨季
    2021-02-13 13:18

    Add @ServletComponentScan in your bootstrap class.

    such as

    @SpringBootApplication
    @ServletComponentScan 
    public class Application {
       public static void main(String[] args) {
           SpringApplication.run(Application.class, args);
       }
    }
    

    This will enable spring boot to scan @WebServlet as well as @WebListener.

提交回复
热议问题