spring监听器


/**
* @description: 监听器
* @author: Lawrence
* @create: 2019-03-18 10:35
* @Version: 2.0
**/
@Component
@ComponentScan
public class Listerner implements HttpSessionListener {

private static int online = 0;

@Override
public void sessionCreated(HttpSessionEvent se) {
System.out.print("创建session,当前在线人数为:"+online+"\n");
online++;
}

@Override
public void sessionDestroyed(HttpSessionEvent se) {
System.out.print("销毁session"+"/n");

}
}
posted @ 2019-03-18 10:56  _Lawrence  阅读(237)  评论(0编辑  收藏  举报