File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/main/java/cn/com/ttblog/ssmbootstrap_table/listener Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments