Skip to content

Commit baa7340

Browse files
committed
update
1 parent 593527a commit baa7340

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package cn.com.ttblog.ssmbootstrap_table.listener;
2+
3+
import cn.com.ttblog.ssmbootstrap_table.event.LoginEvent;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
import org.springframework.context.ApplicationListener;
7+
import org.springframework.scheduling.annotation.Async;
8+
import org.springframework.stereotype.Component;
9+
import java.util.concurrent.TimeUnit;
10+
11+
@Component
12+
public class LoginProcessListener implements ApplicationListener<LoginEvent> {
13+
14+
private static final Logger LOG=LoggerFactory.getLogger(LoginProcessListener.class);
15+
16+
/**
17+
* @Async异步处理
18+
*/
19+
@Async
20+
@Override
21+
public void onApplicationEvent(LoginEvent loginEvent) {
22+
try {
23+
TimeUnit.SECONDS.sleep(60);
24+
} catch (InterruptedException e) {
25+
LOG.error("sleep error",e);
26+
}
27+
LOG.debug("异步记录用户登录日志:{}",loginEvent);
28+
}
29+
}

0 commit comments

Comments
 (0)