Spring 3.5 how to add HttpSessionEventPublisher to my boot configuration

前端 未结 4 2180
别那么骄傲
别那么骄傲 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条回答
  •  猫巷女王i
    2021-02-08 11:27

    Just to provide reference to official documentation, http://docs.spring.io/spring-session/docs/current-SNAPSHOT/reference/html5/#httpsession-rest

    Here if you refer to, HttpSessionListener topic, you will find the clear example of doing it both Java and XML configuration way.

    if your configuration support Redis

    @Configuration
    @EnableRedisHttpSession
    public class RedisHttpSessionConfig {
    
        @Bean
        public HttpSessionEventPublisher httpSessionEventPublisher() {
                return new HttpSessionEventPublisher();
        }
    
        // ...
    }
    

    In XML configuration, this might look like

    
    

提交回复
热议问题