How can I register a secondary servlet with Spring Boot?

后端 未结 7 680
感动是毒
感动是毒 2020-11-30 19:29

I have an extra servlet I need to register in my application. However with Spring Boot and its Java Config, I can\'t just add servlet mappings in a web.xml file

7条回答
  •  旧时难觅i
    2020-11-30 20:11

    Just add a bean for the servlet. It'll get mapped to /{beanName}/.

    @Bean
    public Servlet foo() {
        return new FooServlet();
    }
    

提交回复
热议问题