Spring 3.5 how to add HttpSessionEventPublisher to my boot configuration

前端 未结 4 2171
别那么骄傲
别那么骄傲 2021-02-08 10:44

I want to listen to session life cycle events. I read about adding


   
     org.springframework.security.web.session.Http         


        
4条回答
  •  执念已碎
    2021-02-08 11:21

    Adding Listener in Class which is extending SpringBootSelvletInitializer can be done as below.

        @Configuration
        public class Application extends SpringBootServletInitializer {
    
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        SpringApplicationBuilder app=application.sources(Application.class, ComponentConfiguration.class);
        app.listeners(bootstrapContext.commandLineListener());
        return app;
    }
    

    As the builder class is having listener method which use to add all the listener which is given to be registered. Github link for SpringApplicationBuilder is http://goo.gl/EGj6jE

    I think this will solve your issue.

    Swaraj

提交回复
热议问题