1. Log section definition
@Aspect @Component public class LogAspect { @Around(value =
"@annotation(log)") public Object log(ProceedingJoinPoint joinPoint, Log log)
throws Throwable { Object result = joinPoint.proceed(); //do something else
Map<String,Object> map = new HashMap<>(); map.put("userDo",result); Object id =
new SimpleTemplateEngine().createTemplate(log.id()).make(map); Object content =
new SimpleTemplateEngine().createTemplate(log.content()).make(map); return
result; } }
2. Log annotation definition
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface
Log { String id() default ""; String content() default ""; }
3. Entity class definition
@Data public class UserDo { private Long id; private String userName; private
int age; }
4. Interface and implementation definition
public interface UserService { UserDo add(UserDo userDo); } @Component public
class UserServiceImpl implements UserService { @Override @Log(id =
"${userDo.id}", content = "${userDo}") public UserDo add(UserDo userDo) {
userDo.setId(1L); userDo.setUserName(" Zhang San "); userDo.setAge(18); return userDo; }
}
 

Technology
©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition