@WebServlet annotation doesn't work with Tomcat 8

后端 未结 3 513
粉色の甜心
粉色の甜心 2020-12-01 16:29

I want to use the @WebServlet annotation in a Java EE webapp which runs on Tomcat 8.

I have read that I need to declare Servlet Version 3.1 in my

3条回答
  •  无人及你
    2020-12-01 17:26

    How about @ServletComponentScan?

    Example from http://www.baeldung.com/spring-servletcomponentscan

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

提交回复
热议问题