Home > Back-end >  Spring - mybatis thread request within all SQL record
Spring - mybatis thread request within all SQL record

Time:10-11

I now have a question, please, answer

The controller layer has a custom annotation @ Log

I want to get on all @ the methods of log notes this method inside all the SQL call chain, finally to somewhere

Then use the aop agent all the mapper class

There are two threads in this aspect class variables - & gt; 1. Whether open records logo - & gt; THREAD_CALL_ENABLED, 2. Record the SQL string - & gt; THREAD_CALL_SQL

In @ the log in the annotations of aop @ before method opens up a record label - & gt; THREAD_CALL_ENABLED. Set (true)

Flag is true, if the thread variable records in aop mapper for the current thread layer mapper SQL records and obtain the SQL string in THREAD_CALL_SQL. Set (SQL), otherwise can't directly pass record

In the last log access, to remove all threads variable operation

Want to know if there's no other way can realize??

For years, to reassure
  • Related