How to add a RequestContextListener with no-xml configuration?

前端 未结 2 2005
清酒与你
清酒与你 2021-01-02 07:42

I need to add a listener to my Spring Boot application, in web.xml it looks like


 
    org.springframework.web.contex         


        
相关标签:
2条回答
  • 2021-01-02 08:24

    Write your own listener class which extends from RequestContextListener and register it via annotation. Something like this:

    @WebListener
    public class MyRequestContextListener extends RequestContextListener {
    }
    
    0 讨论(0)
  • 2021-01-02 08:45

    I created this class and that solved my issue.

    @Configuration
    @WebListener
    public class MyRequestContextListener extends RequestContextListener {
    }
    
    0 讨论(0)
提交回复
热议问题